forked from SamTV12345/PodFetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (41 loc) · 1.27 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM node:alpine as ui-builder
WORKDIR /app
COPY ./ui/ ./
RUN npm install && npm run build
FROM rust:alpine3.17 as dependency-cache
USER root
RUN apk add pkgconfig openssl-dev libc-dev
WORKDIR /app/src
ADD Cargo.lock .
ADD Cargo.toml .
ADD build.rs .
ADD dummy.rs ./src/main.rs
RUN RUSTFLAGS='-C target-feature=-crt-static' cargo build --release
FROM rust:alpine3.17 as builder
USER root
WORKDIR /app/src
RUN apk add pkgconfig openssl-dev libc-dev
COPY --from=dependency-cache /usr/local/cargo /usr/local/cargo
COPY --from=dependency-cache /app/src/target/ /app/src/target/
COPY --from=ui-builder /app/dist /app/src/static
RUN rm -rf /app/src/target/release/deps/podfetch*
RUN rm -rf /app/src/target/release/podfetch*
ADD Cargo.lock .
ADD Cargo.toml .
ADD static ./static
ADD migrations ./migrations
ADD db ./db
ADD build.rs .
ADD src ./src
RUN RUSTFLAGS='-C target-feature=-crt-static' cargo build --release
FROM library/alpine:latest
WORKDIR /app/
RUN apk add libgcc tzdata
ENV TZ=Europe/Berlin
COPY --from=builder /app/src/target/release/podfetch /app/podfetch
COPY --from=builder /app/src/migrations /app/migrations
COPY --from=builder /app/src/db /app/db
COPY --from=ui-builder /app/dist /app/static
COPY ./docs/default.jpg /app/static/default.jpg
EXPOSE 8000
CMD ["./podfetch"]