Files
tmpl/Containerfile
Dustin C. Hatch d25d876df5 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.

Reimplementing this change because this image is no longer the base for
*infra/cfg*.  That image is now based on Alpine and copies in the `tmpl`
executable.
2024-01-19 10:04:26 -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'