Skip to content

Commit af54cf4

Browse files
committed
base: Allow specifying custom Ubuntu mirror as build arg
This commit updates the base Dockerfile such that the Ubuntu mirrors used while building the image is specifiable as build arguments. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 7fd3c6e commit af54cf4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Dockerfile.base

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ ARG USERNAME=user
66
ARG UID=1000
77
ARG GID=1000
88
ARG PYTHON_VENV_PATH=/opt/python/venv
9+
ARG UBUNTU_MIRROR_ARCHIVE=archive.ubuntu.com/ubuntu
10+
ARG UBUNTU_MIRROR_SECURITY=security.ubuntu.com/ubuntu
11+
ARG UBUNTU_MIRROR_PORTS=ports.ubuntu.com/ubuntu-ports
912

1013
# this conflicts with uid 1000, remove it
1114
RUN userdel -r ubuntu || true
@@ -16,6 +19,11 @@ SHELL ["/bin/bash", "-c"]
1619
# Set non-interactive frontend for apt-get to skip any user confirmations
1720
ENV DEBIAN_FRONTEND=noninteractive
1821

22+
# Set up Ubuntu mirrors
23+
RUN sed -i "s#archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR_ARCHIVE}#" /etc/apt/sources.list.d/ubuntu.sources && \
24+
sed -i "s#security.ubuntu.com/ubuntu#${UBUNTU_MIRROR_SECURITY}#" /etc/apt/sources.list.d/ubuntu.sources && \
25+
sed -i "s#ports.ubuntu.com/ubuntu-ports#${UBUNTU_MIRROR_PORTS}#" /etc/apt/sources.list.d/ubuntu.sources
26+
1927
# Install base packages
2028
RUN apt-get -y update && \
2129
apt-get -y upgrade && \

0 commit comments

Comments
 (0)