diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1164892228e8575e892ca8c2c3ce651c9ae84608..a9b7d26e135c3aaeff8fa82677395c5de0cc2a48 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,19 @@ include: - - project: 'container-library/build-ah-engine' - ref: 2.1.4 - file: '/gitlab-ci-template.yml' + - project: 'shivering-isles/infrastructure-gitops' + ref: main + file: '/images/.utils/gitlab-earthly.yaml' -variables: - CI_CONTAINER_BUILD_ARCHS: "amd64" - -container-tagging: - before_script: - - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - - export BUILD_DATE="$(date --rfc-3339 ns)" - - export CI_REGISTRY_IMAGE_VERSION=$(grep 'ARG DNSPROXY_VERSION=' Dockerfile | sed -e 's/^ARG DNSPROXY_VERSION=v//g') +build: + extends: .earthly + script: + - | + if [ -n "$CI_OCI_CACHE" ]; then + export ARGS="${ARGS} --remote-cache=$CI_OCI_CACHE" + fi + - | + if [ $CI_COMMIT_BRANCH = $CI_DEFAULT_BRANCH ]; then + export BUILD_ARGS="${BUILD_ARGS} --latest=true" + else + export BUILD_ARGS="${BUILD_ARGS} --tag=$CI_COMMIT_REF_SLUG --latest=false" + fi + - earthly --ci --allow-privileged --push ${ARGS} +container --registry=${CI_REGISTRY_IMAGE} ${BUILD_ARGS} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 39b65f27b3857ff7b715236a18c5710151571140..0000000000000000000000000000000000000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM docker.io/library/golang:1.21.0 as build-env - -# renovate: datasource=git-tags depName=https://git.shivering-isles.com/github-mirror/AdguardTeam/dnsproxy.git -ARG DNSPROXY_VERSION=v0.54.0 -ENV DNSPROXY_VERSION=${DNSPROXY_VERSION} -ENV CGO_ENABLED=0 - -RUN true \ - && git clone https://git.shivering-isles.com/github-mirror/AdguardTeam/dnsproxy.git --depth 1 -b "$DNSPROXY_VERSION" \ - && cd dnsproxy \ - && go build -mod=vendor - - -FROM gcr.io/distroless/static - -COPY --from=build-env /go/dnsproxy/dnsproxy / -CMD ["/dnsproxy"] - diff --git a/Earthfile b/Earthfile new file mode 100644 index 0000000000000000000000000000000000000000..61ce6d0d6a5107ad1fa374220b58df31d81ed14c --- /dev/null +++ b/Earthfile @@ -0,0 +1,37 @@ +VERSION 0.7 + +# build creates a binary release of dnsproxy +build: + FROM git.shivering-isles.com/shivering-isles/infrastructure-gitops/images/mirror+golang + WORKDIR /go-workdir + ARG DNSPROXY_VERSION + ENV CGO_ENABLED=0 + + GIT CLONE --keep-ts --branch "${DNSPROXY_VERSION}" https://git.shivering-isles.com/github-mirror/AdguardTeam/dnsproxy.git ./ + + RUN go build -mod=vendor + SAVE ARTIFACT ./dnsproxy AS LOCAL local-output/dnsproxy + +container-internal: + FROM git.shivering-isles.com/shivering-isles/infrastructure-gitops/images/mirror+distroless-static + # renovate: datasource=git-tags depName=https://git.shivering-isles.com/github-mirror/AdguardTeam/dnsproxy.git + ARG DNSPROXY_VERSION + ENV DNSPROXY_VERSION=${DNSPROXY_VERSION} + + COPY (+build/dnsproxy --DNSPROXY_VERSION=${DNSPROXY_VERSION}) /dnsproxy + CMD ["/dnsproxy"] + +# container builds the dnsproxy container +container: + FROM git.shivering-isles.com/shivering-isles/infrastructure-gitops/images/mirror+golang + # renovate: datasource=git-tags depName=https://git.shivering-isles.com/github-mirror/AdguardTeam/dnsproxy.git + ARG DNSPROXY_VERSION=v0.54.0 + ARG registry=quay.io/shivering-isles/dnsproxy + ARG tag=${DNSPROXY_VERSION} + ARG latest=false + IF [ $latest = "true" ] + FROM +container-internal --DNSPROXY_VERSION=${DNSPROXY_VERSION} + SAVE IMAGE --push ${registry}:latest + END + FROM +container-internal --DNSPROXY_VERSION=${DNSPROXY_VERSION} + SAVE IMAGE --push ${registry}:${tag} diff --git a/renovate.json b/renovate.json index 1091398a69668a6c766634582966ddac7548e0d4..a9abb3dae33d4cd448013efeb86e346b5e4e20d2 100644 --- a/renovate.json +++ b/renovate.json @@ -1,7 +1,15 @@ { "extends": [ - "config:base", - "regexManagers:dockerfileVersions" + "config:base" + ], + "regexManager": [ + { + "fileMatch": ["Dockerfile$","Earthfile$"], + "matchStrings": [ + "#\\s*renovate:\\s*datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\sENV .*?_VERSION=\"(?<currentValue>.*)\"\\s" + ], + "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" + } ], "prConcurrentLimit": 5, "automerge": true,