-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(docker): move to alpine for smaller image
- Loading branch information
Showing
1 changed file
with
11 additions
and
23 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,25 +1,13 @@ | ||
FROM rust:1.79 AS builder | ||
WORKDIR /usr/src/pumpkin | ||
COPY . . | ||
RUN ls | ||
RUN cargo install --path ./pumpkin | ||
|
||
FROM rust | ||
FROM rust:1-alpine3.19 AS builder | ||
ENV RUSTFLAGS="-C target-feature=-crt-static" | ||
RUN apk add --no-cache musl-dev | ||
WORKDIR /pumpkin | ||
RUN apt update && apt-get install -y libssl-dev pkg-config ca-certificates && rm -rf /var/lib/apt/lists/* | ||
COPY --from=builder /usr/local/cargo/bin/pumpkin /pumpkin/pumpkin | ||
CMD ["/pumpkin/pumpkin"] | ||
|
||
# FROM rust:1.79-alpine AS builder | ||
# WORKDIR /usr/src/pumpkin | ||
# COPY . . | ||
# RUN apk add openssl-dev libssl3 ca-certificates pkgconfig musl-dev | ||
# RUN cargo install --path ./pumpkin | ||
COPY . /pumpkin | ||
RUN cargo build --release | ||
RUN strip target/release/pumpkin | ||
|
||
# FROM rust:1.79-alpine | ||
# WORKDIR /pumpkin | ||
# RUN apk add openssl ca-certificates pkgconfig | ||
# COPY --from=builder /usr/local/cargo/bin/pumpkin /pumpkin/pumpkin | ||
# CMD ["/pumpkin/pumpkin"] | ||
|
||
#docker run --rm -v "./world:/pumpkin/world" pumpkin | ||
FROM alpine:3.19 | ||
WORKDIR /pumpkin | ||
RUN apk add --no-cache libgcc | ||
COPY --from=builder /pumpkin/target/release/pumpkin /pumpkin/pumpkin | ||
ENTRYPOINT ["/pumpkin/pumpkin"] |