Files
AdGuardHome/docker/snapcraft.Dockerfile
T
Maksim Kazantsev 3f153ea7cb Pull request 2636: AGDNS-3914-increase-snapcraft-build-stability
Squashed commit of the following:

commit 689c4bdc8bb1639572e25e630d1cbfbd6f807f7f
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Fri Apr 17 15:33:43 2026 +0300

    snap: imp download.sh

commit 0dec7e32d3888a04042e1e7390921a1b64048ac5
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Fri Apr 17 15:16:03 2026 +0300

    all: rm result file;

commit 6884679c6dd011138f8c05e4550428ec3b7fde3c
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Fri Apr 17 15:11:52 2026 +0300

    snap: imp download.sh

commit 1412a0b66bf63bcad312568c496a9c3bef0a16ef
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Thu Apr 16 20:06:09 2026 +0300

    snap: use query param;

commit 40c199d22754f201586f3c8ed3177465ac758060
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Thu Apr 16 19:53:53 2026 +0300

    docker: set cache buster env;

commit 8bbde2221017074f23bc23b6b2ab3562af4e719a
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Thu Apr 16 19:51:41 2026 +0300

    all: rm .tar.gz

commit 827f51d8710e7b417016ed31d9b17461ce2c28b4
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Thu Apr 16 19:49:52 2026 +0300

    snap: fix script;

commit ff439b787122e9082472e56b1ca32b0ba632e5b9
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Thu Apr 16 19:46:49 2026 +0300

    snap: add cache buster url param;
2026-04-17 14:33:32 +00:00

89 lines
2.7 KiB
Docker

# syntax=docker/dockerfile:1
# This comment is used to simplify checking local copies of the Dockerfile.
# Bump this number every time a significant change is made to this Dockerfile.
#
# AdGuard-Project-Version: 11
# Dockerfile guidelines:
#
# 1. Make sure that Docker correctly caches layers, on a second build attempt it
# must not run lint / test second time when it's not required.
#
# 2. Use BuildKit to improve the build performance (--mount=type=cache, etc).
#
# 3. Prefer using ARG instead of ENV when appropriate, as ARG does not create a
# layer in the final image. However, be careful with what you use ARG for.
# Also, prefer to give ARGs sensible default values.
#
# 4. Use --output and the export stage if you need to get any output on the host
# machine.
#
# NOTE: Only use --output with FROM scratch.
#
# 5. Use .dockerignore to prevent unnecessary files from being sent to the
# Docker daemon, which can invalidate the cache.
#
# 6. Add a CACHE_BUSTER argument to stages to be able to rerun the stages if
# needed. Keep it in sync with bamboo-specs/snapcraft.yaml.
# NOTE: Keep in sync with bamboo-specs/snapcraft.yaml.
ARG BASE_IMAGE=adguard/snap-builder:2.1
# builder downloads the release artifacts and builds snap artifacts.
FROM "$BASE_IMAGE" AS builder
ARG CACHE_BUSTER=0
ARG CHANNEL=development
ARG VERSION=""
ADD snap /app/snap
ADD scripts /app/scripts
WORKDIR /app
RUN \
<<-'EOF'
set -e -f -u -x
export VERBOSE='1'
env \
CHANNEL="${CHANNEL}" \
CACHE_BUSTER="${CACHE_BUSTER}" \
sh ./scripts/snap/download.sh \
;
sh ./scripts/snap/build.sh
EOF
# builder-exporter exports the build artifacts to the host machine so that they
# could be published. This stage should only be used in a CI.
FROM scratch AS builder-exporter
ARG CACHE_BUSTER=0
ARG VERSION=""
COPY --from=builder /app/AdGuardHome_amd64.snap /AdGuardHome_amd64.snap
COPY --from=builder /app/AdGuardHome_arm64.snap /AdGuardHome_arm64.snap
COPY --from=builder /app/AdGuardHome_armhf.snap /AdGuardHome_armhf.snap
COPY --from=builder /app/AdGuardHome_i386.snap /AdGuardHome_i386.snap
# publisher uploads the release artifacts to the Snap Store.
FROM "$BASE_IMAGE" AS publisher
ARG CACHE_BUSTER=0
ARG SNAPCRAFT_CHANNEL=0
ARG SNAPCRAFT_STORE_CREDENTIALS=0
ARG VERSION=""
ADD snap /app/snap
ADD scripts /app/scripts
ADD AdGuardHome_amd64.snap /app/AdGuardHome_amd64.snap
ADD AdGuardHome_arm64.snap /app/AdGuardHome_arm64.snap
ADD AdGuardHome_armhf.snap /app/AdGuardHome_armhf.snap
ADD AdGuardHome_i386.snap /app/AdGuardHome_i386.snap
WORKDIR /app
RUN \
<<-'EOF'
set -e -f -u -x
env \
SNAPCRAFT_CHANNEL="${SNAPCRAFT_CHANNEL}" \
SNAPCRAFT_STORE_CREDENTIALS="${SNAPCRAFT_STORE_CREDENTIALS}" \
VERBOSE='1' \
sh ./scripts/snap/upload.sh
EOF