-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update .dockerignore and Dockerfile to include/exclude specific files…
… and directories for Docker image building and deployment.
- Loading branch information
1 parent
dce7266
commit cb0dffb
Showing
2 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
**/target | ||
.env | ||
.dockerignore | ||
spec.yaml | ||
target/ | ||
deploy/ | ||
tests/ | ||
Dockerfile | ||
scripts/ | ||
migrations/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,30 @@ | ||
FROM rust:latest | ||
FROM lukemathwalker/cargo-chef:latest-rust-1.78.0 as chef | ||
WORKDIR /app | ||
RUN apt update && apt install lld clang -y | ||
|
||
FROM chef as planner | ||
COPY . . | ||
# Compute a lock-like file for our project | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef as builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
# Build our project dependencies, not our application! | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
COPY . . | ||
ENV SQLX_OFFLINE true | ||
RUN cargo build --release | ||
# Build our project | ||
RUN cargo build --release --bin zero2prod | ||
|
||
FROM debian:bookworm-slim AS runtime | ||
WORKDIR /app | ||
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 configuration configuration | ||
ENV APP_ENVIRONMENT production | ||
ENTRYPOINT ["./target/release/zero2prod"] | ||
ENTRYPOINT ["./zero2prod"] |