2024-02-07 12:14:51 +01:00
|
|
|
# Builder stage
|
|
|
|
|
FROM rust:1.75.0 AS builder
|
|
|
|
|
|
2024-02-07 12:07:03 +01:00
|
|
|
WORKDIR /app
|
|
|
|
|
RUN apt update && apt install lld clang -y
|
|
|
|
|
COPY . .
|
|
|
|
|
ENV SQLX_OFFLINE true
|
|
|
|
|
RUN cargo build --release
|
2024-02-07 12:14:51 +01:00
|
|
|
|
|
|
|
|
# Runtime stage
|
|
|
|
|
FROM rust:1.75.0-slim AS runtime
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
# Copy the compiled binary from the builder environment
|
|
|
|
|
# to our runtime environment
|
|
|
|
|
COPY --from=builder /app/target/release/learn_axum zero2prod
|
|
|
|
|
# We need the configuration file at runtime!
|
|
|
|
|
COPY configuration configuration
|
2024-02-07 12:07:03 +01:00
|
|
|
ENV APP_ENVIRONMENT production
|
2024-02-07 12:14:51 +01:00
|
|
|
ENTRYPOINT ["./zero2prod"]
|