Loading .gitlab-ci.yml +20 −13 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ variables: value: 9.16.23 description: BIND release build: Build Images: stage: build image: docker.kodo.org.uk/ci-images/buildkit/buildctl:latest tags: [buildkit] Loading @@ -11,30 +11,37 @@ build: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "merge_request_event" timeout: 2 hours script: - BUILD_TAG=${CI_REGISTRY_IMAGE}:build-${CI_PIPELINE_IID} - buildctl build - build() buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt target=$1 --opt build-arg:BIND9_VERSION=${BIND9_VERSION} --opt label:bind9.version=${BIND9_VERSION} --opt platform=linux/amd64,linux/arm64 --output type=image,name=${BUILD_TAG},push=true --output type=image,name=${CI_REGISTRY_IMAGE}/$1:build-${CI_PIPELINE_IID},push=true - build named - build nsupdate tag: Tag Images: stage: deploy image: docker.kodo.org.uk/ci-images/docker-reg:latest variables: TARGET: named rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: TAG: latest TAGS: latest $BIND9_VERSION - if: $CI_COMMIT_BRANCH == "develop" variables: TAG: unstable script: | BUILD_TAG=${CI_REGISTRY_IMAGE}:build-${CI_PIPELINE_IID} docker-reg $BUILD_TAG retag $TAG if [ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]; then docker-reg $BUILD_TAG retag $BIND9_VERSION fi TAGS: unstable script: - retag() for tag in $TAGS; do docker-reg ${CI_REGISTRY_IMAGE}/$1:build-${CI_PIPELINE_IID} retag ${tag}; done - retag named - retag nsupdate Dockerfile +11 −2 Original line number Diff line number Diff line Loading @@ -19,13 +19,22 @@ RUN ./configure --disable-linux-caps --without-python --prefix=/ RUN make RUN make install ENV STAGE=/stages/named RUN stage-useradd bind RUN collect-binaries /sbin/named RUN mkdir -p /stage/etc/bind /stage/var/run/named RUN chown 1:1 /stage/var/run/named ENV STAGE=/stages/nsupdate RUN collect-binaries /bin/nsupdate FROM scratch COPY --from=build /stage/ / FROM scratch AS named COPY --from=build /stages/named/ / WORKDIR /var/run/named ENTRYPOINT ["/sbin/named", "-g", "-ubind", "-c/etc/bind/named.conf"] FROM scratch AS nsupdate COPY --from=build /stages/nsupdate/ / ENTRYPOINT ["/bin/nsupdate"] Loading
.gitlab-ci.yml +20 −13 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ variables: value: 9.16.23 description: BIND release build: Build Images: stage: build image: docker.kodo.org.uk/ci-images/buildkit/buildctl:latest tags: [buildkit] Loading @@ -11,30 +11,37 @@ build: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "merge_request_event" timeout: 2 hours script: - BUILD_TAG=${CI_REGISTRY_IMAGE}:build-${CI_PIPELINE_IID} - buildctl build - build() buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt target=$1 --opt build-arg:BIND9_VERSION=${BIND9_VERSION} --opt label:bind9.version=${BIND9_VERSION} --opt platform=linux/amd64,linux/arm64 --output type=image,name=${BUILD_TAG},push=true --output type=image,name=${CI_REGISTRY_IMAGE}/$1:build-${CI_PIPELINE_IID},push=true - build named - build nsupdate tag: Tag Images: stage: deploy image: docker.kodo.org.uk/ci-images/docker-reg:latest variables: TARGET: named rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: TAG: latest TAGS: latest $BIND9_VERSION - if: $CI_COMMIT_BRANCH == "develop" variables: TAG: unstable script: | BUILD_TAG=${CI_REGISTRY_IMAGE}:build-${CI_PIPELINE_IID} docker-reg $BUILD_TAG retag $TAG if [ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]; then docker-reg $BUILD_TAG retag $BIND9_VERSION fi TAGS: unstable script: - retag() for tag in $TAGS; do docker-reg ${CI_REGISTRY_IMAGE}/$1:build-${CI_PIPELINE_IID} retag ${tag}; done - retag named - retag nsupdate
Dockerfile +11 −2 Original line number Diff line number Diff line Loading @@ -19,13 +19,22 @@ RUN ./configure --disable-linux-caps --without-python --prefix=/ RUN make RUN make install ENV STAGE=/stages/named RUN stage-useradd bind RUN collect-binaries /sbin/named RUN mkdir -p /stage/etc/bind /stage/var/run/named RUN chown 1:1 /stage/var/run/named ENV STAGE=/stages/nsupdate RUN collect-binaries /bin/nsupdate FROM scratch COPY --from=build /stage/ / FROM scratch AS named COPY --from=build /stages/named/ / WORKDIR /var/run/named ENTRYPOINT ["/sbin/named", "-g", "-ubind", "-c/etc/bind/named.conf"] FROM scratch AS nsupdate COPY --from=build /stages/nsupdate/ / ENTRYPOINT ["/bin/nsupdate"]