From 75406f4206f0d5e28edad944e6d1e6fff7f62514 Mon Sep 17 00:00:00 2001 From: gigirassy Date: Thu, 27 Aug 2026 23:29:10 -0400 Subject: [PATCH] custom dockerfile --- Dockerfile.custom | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Dockerfile.custom diff --git a/Dockerfile.custom b/Dockerfile.custom new file mode 100644 index 0000000..993d265 --- /dev/null +++ b/Dockerfile.custom @@ -0,0 +1,43 @@ +FROM 11notes/alpine:stable as builder + +USER root + +RUN apk update && apk add ca-certificates musl-dev build-base openssl-dev curl + +ENV PATH="/root/.cargo/bin:${PATH}" + +WORKDIR /app +COPY Cargo.toml . +COPY src ./src + +RUN mkdir -p /root/.cargo && printf '\ + [profile.release]\n\ + lto = true\n\ + codegen-units = 1\n\ + opt-level = '3'\n\ + panic = "abort"\n\ + strip = true\n + [target.x86_64-unknown-linux-gnu]\n\ + rustflags = [\n\ + "-C", "target-cpu=native",\n\ + "-C", "codegen-units=1",\n\ + "-C", "debuginfo=0"\n\ + ]\n' > /root/.cargo/config.toml + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y + +RUN rustup target add x86_64-unknown-linux-musl + +RUN RUSTFLAGS="-Ctarget-feature=+crt-static" cargo build --release --target x86_64-unknown-linux-musl + +FROM scratch + +USER 65534:65534 + +COPY --from=builder --chown=65534:65534 /app/target/x86_64-unknown-linux-musl/release/image-proxy /usr/bin/image-proxy + +COPY --from=builder /etc/ssl /etc/ssl + +EXPOSE 8080 + +ENTRYPOINT ["/usr/bin/image-proxy"]