Skip to content

Commit

Permalink
switch to use dynamic linking for alpine docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Aug 22, 2024
1 parent 68ef9be commit 6f21d54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion g3fcgen/docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM rust:alpine AS builder
WORKDIR /usr/src/g3
COPY . .
RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static
RUN apk add --no-cache musl-dev openssl-dev
ENV RUSTFLAGS="-Ctarget-feature=-crt-static"
RUN cargo build --profile release-lto -p g3fcgen

FROM alpine:latest
RUN apk add --no-cache libgcc
COPY --from=builder /usr/src/g3/target/release-lto/g3fcgen /usr/bin/g3fcgen
ENTRYPOINT ["/usr/bin/g3fcgen"]
CMD ["-Vvv"]
2 changes: 2 additions & 0 deletions g3iploc/docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ FROM rust:alpine AS builder
WORKDIR /usr/src/g3
COPY . .
RUN apk add --no-cache musl-dev
ENV RUSTFLAGS="-Ctarget-feature=-crt-static"
RUN cargo build --profile release-lto -p g3iploc

FROM alpine:latest
RUN apk add --no-cache libgcc
COPY --from=builder /usr/src/g3/target/release-lto/g3iploc /usr/bin/g3iploc
ENTRYPOINT ["/usr/bin/g3iploc"]
CMD ["-Vvv"]
4 changes: 3 additions & 1 deletion g3proxy/docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM rust:alpine AS builder
WORKDIR /usr/src/g3
COPY . .
RUN apk add --no-cache musl-dev cmake capnproto-dev openssl-dev openssl-libs-static c-ares-dev c-ares-static
RUN apk add --no-cache musl-dev cmake capnproto-dev openssl-dev c-ares-dev
ENV RUSTFLAGS="-Ctarget-feature=-crt-static"
RUN cargo build --profile release-lto \
--no-default-features --features quic,c-ares,hickory \
-p g3proxy -p g3proxy-ctl

FROM alpine:latest
RUN apk add --no-cache libgcc c-ares
RUN apk add --no-cache ca-certificates
COPY --from=builder /usr/src/g3/target/release-lto/g3proxy /usr/bin/g3proxy
COPY --from=builder /usr/src/g3/target/release-lto/g3proxy-ctl /usr/bin/g3proxy-ctl
Expand Down

1 comment on commit 6f21d54

@NinoSkopac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great

Please sign in to comment.