Fix tekton pipelines.
Some checks failed
format Build format has failed
clippy Build clippy has failed
rust-test Build rust-test has succeeded
build Build build has succeeded

This commit is contained in:
Tom Alexander
2026-07-10 23:22:55 -04:00
parent 3cdde05975
commit a692628690
8 changed files with 107 additions and 69 deletions

View File

@@ -1,16 +1,40 @@
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION="3.20"
#
# Builder
#
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder
FROM nixos/nix:2.31.3 AS builder
RUN apk add --no-cache musl-dev
RUN cp "$(nix --extra-experimental-features "nix-command flakes" --option filter-syscalls false build nixpkgs#cacert --print-out-paths)/etc/ssl/certs/ca-bundle.crt" /tmp/ca-bundle.crt
RUN mkdir /root/natter
WORKDIR /root/natter
COPY --link . .
# TODO: Add static build, which currently errors due to proc_macro. RUSTFLAGS="-C target-feature=+crt-static"
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked CARGO_TARGET_DIR=/target cargo build --profile release-lto
COPY . /tmp/build
WORKDIR /tmp/build
FROM alpine:$ALPINE_VERSION AS runner
RUN nix \
--extra-experimental-features "nix-command flakes" \
--option filter-syscalls false \
build '.#docker_env'
COPY --link --from=builder /target/release-lto/natter /usr/bin/
# Export the built closure to a folder
RUN mkdir /tmp/nix-store-closure
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure
#
# Runner
#
FROM scratch
WORKDIR /app
ENV PATH="$PATH:/app/bin"
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt
ENV NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt
COPY --from=builder /tmp/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt
COPY --from=builder /tmp/nix-store-closure /nix/store
COPY --from=builder /tmp/build/result /app
EXPOSE 8080
CMD ["/app/bin/natter"]