mirror of
https://github.com/kristoferssolo/zero2prod.git
synced 2025-10-21 20:10:40 +00:00
chore(docker): optimize dockerfile
This commit is contained in:
parent
c2b4ac560a
commit
84d9656418
8
.dockerfile
Normal file
8
.dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
.env
|
||||
target/
|
||||
tests/
|
||||
Dockerfile
|
||||
README.md
|
||||
LICENSE
|
||||
scripts/
|
||||
migrations/
|
||||
20
Dockerfile
20
Dockerfile
@ -1,8 +1,24 @@
|
||||
FROM rust:1.77.0
|
||||
FROM rust:1.77.0 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
RUN apt-get update && apt-get install lld clang -y
|
||||
COPY . .
|
||||
ENV SQLX_OFFLINE true
|
||||
RUN cargo build --release
|
||||
|
||||
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
WORKDIR /app
|
||||
# Install OpenSSL - it is dynamically linked by some of our dependencies
|
||||
# Install ca-certificates - it is needed to verify TLS certificates when establishing HTTPS connections
|
||||
RUN apt-get update -y \
|
||||
&& apt-get install -y --no-install-recommends openssl ca-certificates \
|
||||
# Clean up
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /app/target/release/zero2prod zero2prod
|
||||
COPY config config
|
||||
ENV APP_ENVIRONMENT production
|
||||
ENTRYPOINT ["./target/release/zero2prod"]
|
||||
ENTRYPOINT ["./zero2prod"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user