Dockerfile: use default apt mirrors

Use default apt mirrors and also check APT_MIRROR
is set before updating mirrors.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit a1d2132bf6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
CrazyMax 2023-01-03 20:01:12 +01:00 committed by Sebastiaan van Stijn
parent 2f917915c6
commit a521843442
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 7 additions and 9 deletions

View file

@ -27,8 +27,7 @@ FROM --platform=$BUILDPLATFORM ${GOLANG_IMAGE} AS base
COPY --from=xx / /
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
ARG APT_MIRROR
RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
RUN test -n "$APT_MIRROR" && sed -ri "s/(httpredir|deb|security).debian.org/${APT_MIRROR}/g" /etc/apt/sources.list || true
ARG DEBIAN_FRONTEND
RUN apt-get update && apt-get install --no-install-recommends -y file
ENV GO111MODULE=off

11
Jenkinsfile vendored
View file

@ -17,7 +17,6 @@ pipeline {
DOCKER_BUILDKIT = '1'
DOCKER_EXPERIMENTAL = '1'
DOCKER_GRAPHDRIVER = 'overlay2'
APT_MIRROR = 'cdn-fastly.deb.debian.org'
CHECK_CONFIG_COMMIT = '33a3680e08d1007e72c3b3f1454f823d8e9948ee'
TESTDEBUG = '0'
TIMEOUT = '120m'
@ -78,7 +77,7 @@ pipeline {
stage("Build dev image") {
steps {
sh '''
docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
docker build --force-rm -t docker:${GIT_COMMIT} .
'''
}
}
@ -190,7 +189,7 @@ pipeline {
stage("Build dev image") {
steps {
sh '''
docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
docker build --force-rm -t docker:${GIT_COMMIT} .
'''
}
}
@ -276,7 +275,7 @@ pipeline {
stage("Build dev image") {
steps {
sh '''
docker buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
docker buildx build --load --force-rm -t docker:${GIT_COMMIT} .
'''
}
}
@ -388,7 +387,7 @@ pipeline {
stage("Build dev image") {
steps {
sh '''
docker buildx build --load --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .
docker buildx build --load --force-rm -t docker:${GIT_COMMIT} .
'''
}
}
@ -472,7 +471,7 @@ pipeline {
}
stage("Build dev image") {
steps {
sh 'docker build --force-rm --build-arg APT_MIRROR -t docker:${GIT_COMMIT} .'
sh 'docker build --force-rm -t docker:${GIT_COMMIT} .'
}
}
stage("Unit tests") {

View file

@ -1,5 +1,5 @@
variable "APT_MIRROR" {
default = "cdn-fastly.deb.debian.org"
default = ""
}
variable "DOCKER_DEBUG" {
default = ""