web-form/Dockerfile

56 lines
2.2 KiB
Docker

FROM stagex/busybox:sx2024.05.0@sha256:8cb9360041cd17e8df33c5cbc6c223875045c0c249254367ed7e0eb445720757 AS busybox
FROM stagex/binutils:sx2024.05.0@sha256:823ad20a58696435f4afd61aadbe7d9e18afde676a94b59a932126fc16ba0761 AS binutils
FROM stagex/musl:sx2024.05.0@sha256:f888fcf45fabaaae3d0268bcec902ceb94edba7bf8d09ef6966ebb20e00b7127 AS musl
FROM stagex/rust:sx2024.05.0@sha256:b982614e41a163f0b4222a7472030e30d466a8a605a1ff41e9731e9921e90f0e AS rust
FROM stagex/gcc:sx2024.05.0@sha256:ce77c0d1576d3c9d7905edd438fc58d2c51c0340a996c09a93c4602534dc2e26 AS gcc
FROM stagex/llvm:sx2024.05.0@sha256:c43abe585e2867d2ef2fad0902f2a264a3c4a429f95dddd00320de59dcf66210 AS llvm
FROM stagex/libunwind:sx2024.05.0@sha256:18d3b25f523d83aec9db229528d83068a5e289cc6dd27c85ab6ed0f0a55bc9a9 AS libunwind
FROM stagex/openssl:sx2024.05.0@sha256:9bd55ed05263a538e6a23c0262edc356c998a24674f3b8ad008a4b117a4cdf3b AS openssl
FROM stagex/zlib:sx2024.05.0@sha256:d0d6eef463a410191e086448c710441109ae72693cb074fe2b795ee033aa6c9d AS zlib
FROM stagex/ca-certificates:sx2024.05.0@sha256:76b232139c838fad3cdc693f839384141c2a5bf6e7f390294a133be1392a9b7a AS ca-certificates
FROM stagex/pkgconf:sx2024.05.0@sha256:2f5128c181a137c259d5304b77d213ca0d9fc85452b034027b47c2431044c5a6 AS pkgconf
FROM scratch AS base
FROM base AS fetch
COPY --from=busybox . /
COPY --from=musl . /
COPY --from=binutils . /
COPY --from=rust . /
COPY --from=gcc . /
COPY --from=llvm . /
COPY --from=libunwind . /
COPY --from=openssl . /
COPY --from=zlib . /
# NOTE: Necessary for `cargo fetch`, but CA trust is not relied upon
COPY --from=ca-certificates . /
COPY --from=pkgconf . /
COPY . /web-form
WORKDIR /web-form
RUN cargo fetch
FROM fetch AS build
ENV RUSTFLAGS='-C codegen-units=1'
RUN --network=none cargo build --frozen --release
FROM build AS install
COPY --from=gcc . /rootfs
COPY --from=musl . /rootfs
COPY --from=libunwind . /rootfs
COPY --from=openssl . /rootfs
RUN --network=none cp /web-form/target/release/website-form /rootfs/usr/bin/website-form
FROM stagex/filesystem:sx2024.05.0@sha256:c504b17edae1bea8c139d058b20bebd383a0be1b4f57565d92cb578012f9c0f8 AS package
COPY --from=install /rootfs /
ENTRYPOINT ["/usr/bin/website-form"]