custom dockerfile

This commit is contained in:
gigirassy
2026-08-27 23:29:10 -04:00
parent afde8cb457
commit 75406f4206
+43
View File
@@ -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"]