added multi stage builds for oci containers
Some checks failed
Build and Release Docker Images / build-and-push (./backend, task/Dockerfile, my-website-v2_task) (pull_request) Has been cancelled
Build and Release Docker Images / build-and-push (./frontend, Dockerfile, my-website-v2_frontend) (pull_request) Has been cancelled
Build and Release Docker Images / create-release (pull_request) Has been cancelled
Build and Release Docker Images / build-and-push (./backend, public/Dockerfile, my-website-v2_public) (pull_request) Has been cancelled
Some checks failed
Build and Release Docker Images / build-and-push (./backend, task/Dockerfile, my-website-v2_task) (pull_request) Has been cancelled
Build and Release Docker Images / build-and-push (./frontend, Dockerfile, my-website-v2_frontend) (pull_request) Has been cancelled
Build and Release Docker Images / create-release (pull_request) Has been cancelled
Build and Release Docker Images / build-and-push (./backend, public/Dockerfile, my-website-v2_public) (pull_request) Has been cancelled
it should help from builds from failing in addition to slimming down the artifact size
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
FROM rust:1.88.0
|
||||
# Build stage
|
||||
FROM rust:1.88.0 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -7,6 +8,16 @@ COPY ./cache ./cache
|
||||
|
||||
RUN cargo build --release --manifest-path ./public/Cargo.toml
|
||||
|
||||
# Runtime stage with Alpine
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache ca-certificates libgcc
|
||||
|
||||
COPY --from=builder /app/public/target/release/public /app/public
|
||||
COPY --from=builder /app/cache ./cache
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["/app/public/target/release/public"]
|
||||
CMD ["/app/public"]
|
||||
|
||||
Reference in New Issue
Block a user