Skip to content

Commit

Permalink
Add more mirrors
Browse files Browse the repository at this point in the history
Future-proof against Ubuntu codename update

This approach works as long the following assumptions hold:
- the location of `/etc/os-release` file does NOT change
- the name of the UBUNTU_CODENAME environment variable does NOT change
- `eclipse-temurin` still uses Ubuntu as it's base
  • Loading branch information
MiguelWeezardo authored and losipiuk committed Mar 23, 2023
1 parent 78473a5 commit 8bfe02a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
8 changes: 8 additions & 0 deletions core/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
#
FROM eclipse-temurin:17-jdk AS builder

COPY default/apt/sources.list.d /etc/apt/sources.list.d

RUN \
set -xeu && \
. /etc/os-release && \
sed -i "s/\${UBUNTU_CODENAME}/${UBUNTU_CODENAME}/g" /etc/apt/sources.list.d/* && \
echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries && \
echo 'Acquire::http::Timeout "15";' > /etc/apt/apt.conf.d/80-timeouts && \
apt-get update -q && \
Expand All @@ -24,8 +28,12 @@ RUN \

FROM eclipse-temurin:17-jdk

COPY default/apt/sources.list.d /etc/apt/sources.list.d

RUN \
set -xeu && \
. /etc/os-release && \
sed -i "s/\${UBUNTU_CODENAME}/${UBUNTU_CODENAME}/g" /etc/apt/sources.list.d/* && \
echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries && \
echo 'Acquire::http::Timeout "15";' > /etc/apt/apt.conf.d/80-timeouts && \
apt-get update -q && \
Expand Down
6 changes: 5 additions & 1 deletion core/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,23 @@ cp "$trino_client" "${WORK_DIR}/"
tar -C "${WORK_DIR}" -xzf "${WORK_DIR}/trino-server-${TRINO_VERSION}.tar.gz"
rm "${WORK_DIR}/trino-server-${TRINO_VERSION}.tar.gz"
cp -R bin "${WORK_DIR}/trino-server-${TRINO_VERSION}"
cp -R default "${WORK_DIR}/"
mkdir -p "${WORK_DIR}/default"
cp -R default/etc "${WORK_DIR}/default/"

TAG_PREFIX="trino:${TRINO_VERSION}"

for arch in "${ARCHITECTURES[@]}"; do
echo "🫙 Building the image for $arch"
mkdir -p "${WORK_DIR}/default/apt/sources.list.d"
cp "default/apt/sources.list.d/mirrors-$arch.sources" "${WORK_DIR}/default/apt/sources.list.d/"
docker build \
"${WORK_DIR}" \
--pull \
--platform "linux/$arch" \
-f Dockerfile \
-t "${TAG_PREFIX}-$arch" \
--build-arg "TRINO_VERSION=${TRINO_VERSION}"
rm -fr "${WORK_DIR}/default/apt/sources.list.d"
done

echo "🧹 Cleaning up the build context directory"
Expand Down
6 changes: 6 additions & 0 deletions core/docker/default/apt/sources.list.d/mirrors-amd64.sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enabled: yes
Types: deb
URIs: https://mirrors.ocf.berkeley.edu/ubuntu/ https://mirror.kumi.systems/ubuntu/
Suites: ${UBUNTU_CODENAME} ${UBUNTU_CODENAME}-updates ${UBUNTU_CODENAME}-backports ${UBUNTU_CODENAME}-security
Components: main restricted universe multiverse
Architectures: amd64
6 changes: 6 additions & 0 deletions core/docker/default/apt/sources.list.d/mirrors-arm64.sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enabled: yes
Types: deb
URIs: https://mirrors.ocf.berkeley.edu/ubuntu-ports/ https://mirror.kumi.systems/ubuntu-ports/
Suites: ${UBUNTU_CODENAME} ${UBUNTU_CODENAME}-updates ${UBUNTU_CODENAME}-backports ${UBUNTU_CODENAME}-security
Components: main restricted universe multiverse
Architectures: arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enabled: yes
Types: deb
URIs: https://mirrors.ocf.berkeley.edu/ubuntu-ports/ https://mirror.kumi.systems/ubuntu-ports/
Suites: ${UBUNTU_CODENAME} ${UBUNTU_CODENAME}-updates ${UBUNTU_CODENAME}-backports ${UBUNTU_CODENAME}-security
Components: main restricted universe multiverse
# This is NOT a typo, Ubuntu calls "little endian" architecture "endian little"
Architectures: ppc64el

0 comments on commit 8bfe02a

Please sign in to comment.