-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile.production
40 lines (31 loc) · 957 Bytes
/
Dockerfile.production
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
# Rust as the base image
FROM rust:1.61 as build
# Create a new empty shell project
RUN USER=root cargo new --bin iptvmanager
WORKDIR /iptvmanager
# Copy our manifests
COPY ./src/Cargo.lock ./Cargo.lock
COPY ./src/Cargo.toml ./Cargo.toml
COPY ./src/db ./db
COPY ./src/api ./api
COPY ./src/iptv ./iptv
COPY ./src/rest-client ./rest-client
COPY ./src/server ./server
# Build only the dependencies to cache them
ENV SQLX_OFFLINE true
RUN cargo build --release
# # Build for release.
RUN rm ./target/release/deps/iptv* && \
rm ./target/release/deps/db* && \
rm ./target/release/deps/api* && \
rm ./target/release/deps/rest* && \
rm ./target/release/deps/server*
RUN cargo build --release
# # The final base image
FROM debian:stable-slim
RUN apt-get update && \
apt-get install libcurl4 -y
# Copy from the previous build
COPY --from=build /iptvmanager/target/release/server /usr/bin/server
# Run the binary
CMD ["/usr/bin/server"]