2025-09-25 08:29:40 +00:00
|
|
|
# syntax = docker/dockerfile:1.11-labs
|
|
|
|
|
|
|
|
|
|
FROM input AS nix-base
|
|
|
|
|
|
|
|
|
|
WORKDIR /
|
|
|
|
|
COPY --link --from=input . .
|
2025-10-27 17:49:29 +00:00
|
|
|
|
2025-09-25 08:29:40 +00:00
|
|
|
RUN \
|
|
|
|
|
--mount=type=cache,dst=/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.cache/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.local/state/nix,sharing=shared \
|
|
|
|
|
<<EOF
|
|
|
|
|
set -eux
|
|
|
|
|
curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install > nix-install
|
|
|
|
|
sh ./nix-install --daemon
|
|
|
|
|
rm nix-install
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FROM nix-base AS build-nix
|
|
|
|
|
|
|
|
|
|
WORKDIR /usr/src/tuwunel
|
|
|
|
|
COPY --link --from=source /usr/src/tuwunel .
|
|
|
|
|
RUN \
|
|
|
|
|
--mount=type=cache,dst=/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.cache/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.local/state/nix,sharing=shared \
|
|
|
|
|
<<EOF
|
|
|
|
|
set -eux
|
2025-10-01 02:41:24 +00:00
|
|
|
|
2025-09-25 08:29:40 +00:00
|
|
|
nix-build \
|
2025-10-01 02:41:24 +00:00
|
|
|
--verbose \
|
2025-09-25 08:29:40 +00:00
|
|
|
--cores 0 \
|
|
|
|
|
--max-jobs $(nproc) \
|
|
|
|
|
--log-format raw \
|
|
|
|
|
.
|
|
|
|
|
|
|
|
|
|
cp -afRL --copy-contents result /opt/tuwunel
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
2025-10-22 11:21:25 +00:00
|
|
|
FROM input AS smoke-nix
|
2025-09-25 08:29:40 +00:00
|
|
|
|
|
|
|
|
WORKDIR /
|
2025-10-22 11:21:25 +00:00
|
|
|
COPY --link --from=nix-base . .
|
2025-09-25 08:29:40 +00:00
|
|
|
|
2025-10-22 11:21:25 +00:00
|
|
|
WORKDIR /usr/src/tuwunel
|
|
|
|
|
COPY --link --from=source /usr/src/tuwunel .
|
2025-10-01 02:41:24 +00:00
|
|
|
ENV TUWUNEL_DATABASE_PATH="/tmp/tuwunel/smoketest.db"
|
2025-09-25 08:29:40 +00:00
|
|
|
ENV TUWUNEL_LOG="info"
|
|
|
|
|
RUN \
|
|
|
|
|
--mount=type=cache,dst=/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.cache/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.local/state/nix,sharing=shared \
|
|
|
|
|
<<EOF
|
|
|
|
|
set -eux
|
2025-10-22 11:21:25 +00:00
|
|
|
alias nix="nix --extra-experimental-features nix-command --extra-experimental-features flakes"
|
|
|
|
|
|
|
|
|
|
nix run \
|
|
|
|
|
--verbose \
|
|
|
|
|
--cores 0 \
|
|
|
|
|
--max-jobs $(nproc) \
|
|
|
|
|
--log-format raw \
|
|
|
|
|
.#all-features \
|
|
|
|
|
-- \
|
|
|
|
|
-Otest='["smoke", "fresh"]' \
|
|
|
|
|
-Oserver_name=\"localhost\" \
|
2026-01-29 17:19:44 -05:00
|
|
|
-Oerror_on_unknown_config_opts=true \
|
2025-09-25 08:29:40 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
2025-10-22 11:21:25 +00:00
|
|
|
FROM input AS nix-pkg
|
2025-09-25 08:29:40 +00:00
|
|
|
|
|
|
|
|
WORKDIR /
|
2025-10-22 11:21:25 +00:00
|
|
|
COPY --link --from=nix-base . .
|
2025-09-25 08:29:40 +00:00
|
|
|
|
|
|
|
|
WORKDIR /usr/src/tuwunel
|
2025-10-22 11:21:25 +00:00
|
|
|
COPY --link --from=source /usr/src/tuwunel .
|
2025-09-25 08:29:40 +00:00
|
|
|
RUN \
|
|
|
|
|
--mount=type=cache,dst=/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.cache/nix,sharing=shared \
|
|
|
|
|
--mount=type=cache,dst=/root/.local/state/nix,sharing=shared \
|
|
|
|
|
<<EOF
|
2025-10-22 11:21:25 +00:00
|
|
|
set -eux
|
|
|
|
|
alias nix="nix --extra-experimental-features nix-command --extra-experimental-features flakes"
|
|
|
|
|
|
|
|
|
|
ID=$(nix-store --realise $(nix path-info --derivation))
|
|
|
|
|
|
|
|
|
|
mkdir -p tuwunel
|
|
|
|
|
nix-store --export $ID > tuwunel/tuwunel.drv
|
|
|
|
|
tar -cvf /opt/tuwunel.nix.tar tuwunel
|
2025-09-25 08:29:40 +00:00
|
|
|
EOF
|