Skip to content

Commit c252092

Browse files
committed
ubuntu: use close mirrors
Use mirrors in CI, enable using --build-arg USE_MIRROR=y and works in CI only. Signed-off-by: Anas Nashif <[email protected]>
1 parent 3f6f1bc commit c252092

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ jobs:
127127
containerfiles: Dockerfile.base
128128
tags: ${{ steps.meta_base.outputs.tags }}
129129
labels: ${{ steps.meta_base.outputs.labels }}
130+
build-args:
131+
USE_MIRROR=y
130132

131133
- name: Build CI image
132134
uses: redhat-actions/buildah-build@v2
@@ -137,6 +139,7 @@ jobs:
137139
labels: ${{ steps.meta_ci.outputs.labels }}
138140
build-args: |
139141
BASE_IMAGE=${{ env.GHCR_BASE }}/${{ env.BASE_IMAGE_NAME }}:${{ steps.meta_base.outputs.version }}
142+
USE_MIRROR=y
140143
extra-args: |
141144
--pull-never
142145
@@ -149,6 +152,7 @@ jobs:
149152
labels: ${{ steps.meta_developer.outputs.labels }}
150153
build-args: |
151154
BASE_IMAGE=${{ env.GHCR_BASE }}/${{ env.CI_IMAGE_NAME }}:${{ steps.meta_ci.outputs.version }}
155+
USE_MIRROR=y
152156
extra-args: |
153157
--pull-never
154158

Dockerfile.base

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
FROM ubuntu:24.04
44

5-
ARG USERNAME=user
65
ARG UID=1000
76
ARG GID=1000
7+
ARG USERNAME=user
8+
ARG USE_MIRROR=n
89
ARG PYTHON_VENV_PATH=/opt/python/venv
910

1011
# this conflicts with uid 1000, remove it
@@ -16,6 +17,20 @@ SHELL ["/bin/bash", "-c"]
1617
# Set non-interactive frontend for apt-get to skip any user confirmations
1718
ENV DEBIAN_FRONTEND=noninteractive
1819

20+
ADD ./hetzner-mirror_x86_64.list /tmp/hetzner-mirror_x86_64.list
21+
ADD ./hetzner-mirror_arm64.list /tmp/hetzner-mirror_arm64.list
22+
23+
RUN if [ "${HOSTTYPE}" = "x86_64" ]; then \
24+
if [ "${USE_MIRROR}" = 'y' ]; then \
25+
cp /tmp/hetzner-mirror_x86_64.list /etc/apt/sources.list.d/hetzner-mirror.list \
26+
; fi \
27+
; fi
28+
RUN if [ "${HOSTTYPE}" = "aarch64" ]; then \
29+
if [ "${USE_MIRROR}" = 'y' ]; then \
30+
cp /tmp/hetzner-mirror_arm64.list /etc/apt/sources.list.d/hetzner-mirror.list \
31+
; fi \
32+
; fi
33+
1934
# Install base packages
2035
RUN apt-get -y update && \
2136
apt-get -y upgrade && \
@@ -87,6 +102,7 @@ RUN apt-get -y update && \
87102
xz-utils \
88103
thrift-compiler
89104

105+
90106
# Install multi-lib gcc (x86 only)
91107
RUN if [ "${HOSTTYPE}" = "x86_64" ]; then \
92108
apt-get install --no-install-recommends -y \

hetzner-mirror_arm64.list

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Packages and Updates from the Hetzner Ubuntu Mirror
2+
deb https://mirror.hetzner.com/ubuntu-ports/packages noble main restricted universe multiverse
3+
deb https://mirror.hetzner.com/ubuntu-ports/packages noble-updates main restricted universe multiverse
4+
deb https://mirror.hetzner.com/ubuntu-ports/packages noble-backports main restricted universe multiverse
5+
deb https://mirror.hetzner.com/ubuntu-ports/packages noble-security main restricted universe multiverse

hetzner-mirror_x86_64.list

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Packages and Updates from the Hetzner Ubuntu Mirror
2+
deb https://mirror.hetzner.com/ubuntu/packages noble main restricted universe multiverse
3+
deb https://mirror.hetzner.com/ubuntu/packages noble-updates main restricted universe multiverse
4+
deb https://mirror.hetzner.com/ubuntu/packages noble-backports main restricted universe multiverse
5+
deb https://mirror.hetzner.com/ubuntu/packages noble-security main restricted universe multiverse

0 commit comments

Comments
 (0)