2021-12-03 10:13:13 +00:00
|
|
|
FROM rust:1.56.1 as builder
|
2021-08-21 15:19:57 +00:00
|
|
|
WORKDIR /app
|
2021-08-22 07:32:48 +00:00
|
|
|
|
2021-12-03 10:13:13 +00:00
|
|
|
COPY . .
|
2021-12-02 07:58:52 +00:00
|
|
|
WORKDIR /app/backend
|
2021-12-03 10:13:13 +00:00
|
|
|
ENV SQLX_OFFLINE true
|
2021-12-02 07:58:52 +00:00
|
|
|
RUN RUSTFLAGS="-C opt-level=2" cargo build --release --bin backend
|
2021-12-03 10:13:13 +00:00
|
|
|
# Size optimization
|
|
|
|
#RUN strip ./target/release/backend
|
|
|
|
|
|
|
|
FROM debian:bullseye-slim AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update -y \
|
|
|
|
&& apt-get install -y --no-install-recommends openssl \
|
|
|
|
# Clean up
|
|
|
|
&& apt-get autoremove -y \
|
|
|
|
&& apt-get clean -y \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
COPY --from=builder /app/backend/target/release/backend /usr/local/bin/backend
|
|
|
|
COPY --from=builder /app/backend/configuration configuration
|
2021-12-01 08:44:58 +00:00
|
|
|
ENV APP_ENVIRONMENT production
|
2021-12-03 10:13:13 +00:00
|
|
|
CMD ["backend"]
|