Skip to content

Commit

Permalink
refactor(docker): move to alpine for smaller image
Browse files Browse the repository at this point in the history
  • Loading branch information
Erb3 committed Aug 24, 2024
1 parent b63b69d commit 303594d
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions Dockerfile
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"]

0 comments on commit 303594d

Please sign in to comment.