Files
tmpl/Containerfile
Dustin C. Hatch 554c1e9cf4
All checks were successful
dustin/tmpl/pipeline/head This commit looks good
container: Build static executable
Building a static executable and distributing it in a "from scratch"
container image dramatically reduces the image size: down to 8 MB from
102 MB.
2024-01-18 19:54:58 -06:00

26 lines
426 B
Docker

FROM docker.io/library/rust:1.73-alpine AS build
RUN --mount=type=cache,target=/var/cache \
apk add \
musl-dev \
&& :
COPY . /src
WORKDIR /src
RUN cargo build --release --locked \
&& strip target/release/tmpl
FROM scratch
COPY --from=build /src/target/release/tmpl /tmpl
ENTRYPOINT ["/tmpl"]
LABEL name='tmpl' \
vendor='Dustin C. Hatch' \
license='MIT OR APACHE-2.0' \
version='0.1.0'