Skip to content

Commit 63760b1

Browse files
thaJeztahchris-crone
authored andcommitted
test/Dockerfile: allow using a mirror for the apt repository
With this change applied, the default debian package repository can be replaced with a mirror; ``` make APT_MIRROR=cdn-fastly.deb.debian.org build-py3 ... Step 5/19 : RUN apt-get update && apt-get -y install gnupg2 pass curl ---> Running in 01c1101a0bd0 Get:1 http://cdn-fastly.deb.debian.org/debian buster InRelease [118 kB] Get:2 http://cdn-fastly.deb.debian.org/debian-security buster/updates InRelease [39.1 kB] Get:3 http://cdn-fastly.deb.debian.org/debian buster-updates InRelease [46.8 kB] Get:4 http://cdn-fastly.deb.debian.org/debian buster/main amd64 Packages [7897 kB] Get:5 http://cdn-fastly.deb.debian.org/debian-security buster/updates/main amd64 Packages [22.8 kB] ``` Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 06c6063 commit 63760b1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ clean:
88

99
.PHONY: build
1010
build:
11-
docker build -t docker-sdk-python -f tests/Dockerfile --build-arg PYTHON_VERSION=2.7 .
11+
docker build -t docker-sdk-python -f tests/Dockerfile --build-arg PYTHON_VERSION=2.7 --build-arg APT_MIRROR .
1212

1313
.PHONY: build-py3
1414
build-py3:
15-
docker build -t docker-sdk-python3 -f tests/Dockerfile .
15+
docker build -t docker-sdk-python3 -f tests/Dockerfile --build-arg APT_MIRROR .
1616

1717
.PHONY: build-docs
1818
build-docs:

tests/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
ARG PYTHON_VERSION=3.7
22

33
FROM python:${PYTHON_VERSION}
4+
5+
ARG APT_MIRROR
6+
RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
7+
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
8+
49
RUN apt-get update && apt-get -y install \
510
gnupg2 \
611
pass \

0 commit comments

Comments
 (0)