@@ -22,6 +22,9 @@ ARG CURL_VERSION=curl-8_16_0
2222# Xdebug Configuration
2323ARG PHP_XDEBUG_CLIENT_PORT=9003
2424
25+ # Debian Mirror Configuration
26+ ARG DEBIAN_MIRROR=
27+
2528FROM php:${PHP_VERSION}-cli AS base
2629
2730# Import ARG values into this stage
@@ -59,6 +62,7 @@ RUN groupadd -g "${APP_GID}" "${APP_USER}" && \
5962FROM base AS dependencies
6063
6164ARG POSTGRES_VERSION=17
65+ ARG DEBIAN_MIRROR=
6266
6367USER root
6468SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
@@ -67,6 +71,14 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
6771RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
6872 --mount=type=cache,target=/var/lib/apt,sharing=locked \
6973 set -eux; \
74+ # Configure Debian mirror \
75+ MIRROR="${DEBIAN_MIRROR:-http://deb.debian.org/debian}" && \
76+ if [ "${MIRROR}" != "http://deb.debian.org/debian" ]; then \
77+ echo "Configuring Debian mirror: ${MIRROR}" ; \
78+ [ -f /etc/apt/sources.list.d/debian.sources ] && sed -i "s|http://deb.debian.org/debian|${MIRROR}|g" /etc/apt/sources.list.d/debian.sources; \
79+ [ -f /etc/apt/sources.list ] && sed -i "s|http://deb.debian.org/debian|${MIRROR}|g" /etc/apt/sources.list; \
80+ echo "Debian mirror configured successfully" ; \
81+ fi && \
7082 apt-get update && \
7183 apt-get install -y --no-install-recommends \
7284 bash-completion \
@@ -106,7 +118,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
106118 --mount=type=cache,target=/var/lib/apt,sharing=locked \
107119 set -eux; \
108120 # Add Debian Backports repository \
109- echo "deb http://deb.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/backports.list && \
121+ MIRROR="${DEBIAN_MIRROR:-http://deb.debian.org/debian}" && \
122+ echo "deb ${MIRROR} bookworm-backports main" > /etc/apt/sources.list.d/backports.list && \
110123 apt-get update && \
111124 # Install latest versions from backports \
112125 apt-get install -y --no-install-recommends -t bookworm-backports \
0 commit comments