Skip to content

Commit bfa8e57

Browse files
committed
Use a docker volume to store apt metdata.
1 parent 99f8972 commit bfa8e57

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

docker/build-images.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ PHP_VERSIONS="5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3"
1414
#PHP_VERSIONS="8.3"
1515
cd images
1616

17+
# Create the apt cache volume
18+
docker volume create apt-cache
19+
1720
export BUILDKIT_STEP_LOG_MAX_SIZE=104857600
1821

1922
# Build the base linux image first.
2023
export DOCKER_BUILDKIT=1
2124

2225
docker rmi --force phpexperts/linux:latest
23-
docker build linux --tag="phpexperts/linux:latest" --no-cache --progress=plain
26+
docker build linux --tag="phpexperts/linux:latest" --no-cache --build-arg VOLUME="apt-cache:/var/lib/apt" --progress=plain
2427
docker tag phpexperts/linux:latest phpexperts/linux:$(date '+%Y-%m-%d')
2528

2629
# Download build assets
@@ -55,35 +58,37 @@ for VERSION in ${PHP_VERSIONS}; do
5558
docker rmi --force phpexperts/web:nginx-php${VERSION}-debug 2> /dev/null
5659
docker rmi --force phpexperts/web:nginx-php${VERSION}-ioncube 2> /dev/null
5760

58-
docker build base --tag="phpexperts/php:latest" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
61+
docker build base --tag="phpexperts/php:latest" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
5962
docker tag phpexperts/php:latest "phpexperts/php:${MAJOR_VERSION}"
6063
docker tag phpexperts/php:latest "phpexperts/php:${VERSION}"
6164

6265
docker rmi --force phpexperts/php:${VERSION}-full
63-
docker build base-full --tag="phpexperts/php:${VERSION}-full" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
66+
docker build base-full --tag="phpexperts/php:${VERSION}-full" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
6467

6568
cp ~/.ssh/id_ed25519 base-oracle/.build-assets/
6669
docker rmi --force phpexperts/php:${VERSION}-oracle
67-
docker build base-oracle --tag="phpexperts/php:${VERSION}-oracle" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
70+
docker build base-oracle --tag="phpexperts/php:${VERSION}-oracle" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
6871
rm -f base-oracle/.build-assets/id_ed25519
6972

70-
docker build base-debug --tag="phpexperts/php:latest-debug" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
73+
docker build base-debug --tag="phpexperts/php:latest-debug" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
7174
docker tag phpexperts/php:latest-debug "phpexperts/php:${MAJOR_VERSION}-debug"
7275
docker tag phpexperts/php:latest-debug "phpexperts/php:${VERSION}-debug"
7376

7477
docker tag "phpexperts/php:${VERSION}" phpexperts/php:latest
75-
docker build web --tag="phpexperts/web:nginx-php${VERSION}" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
76-
docker build web-debug --tag="phpexperts/web:nginx-php${VERSION}-debug" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
78+
docker build web --tag="phpexperts/web:nginx-php${VERSION}" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
79+
docker build web-debug --tag="phpexperts/web:nginx-php${VERSION}-debug" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
7780

7881

7982
# IonCube doesn't support PHP v8.0 or v8.3.
8083
if [[ "$VERSION" != "8.0" && "$VERSION" != "8.3" ]]; then
8184
echo "Building IonCube for PHP v${VERSION}"
82-
docker build base-ioncube --tag="phpexperts/php:${VERSION}-ioncube" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
83-
docker build web-ioncube --tag="phpexperts/web:nginx-php${VERSION}-ioncube" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
85+
docker build base-ioncube --tag="phpexperts/php:${VERSION}-ioncube" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
86+
docker build web-ioncube --tag="phpexperts/web:nginx-php${VERSION}-ioncube" --build-arg VOLUME="apt-cache:/var/lib/apt" --build-arg PHP_VERSION=$VERSION --no-cache --progress=plain
8487
fi
8588
done
8689

90+
docker volume rm apt-cache
91+
8792
#docker rmi --force phpexperts/php:8.2 phpexperts/web:nginx-php8.2
8893
#docker build base-php8 --tag="phpexperts/php:8.2" --no-cache --progress=plain
8994

docker/images/linux/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ RUN echo "Building base Linux..." && \
3030

3131
WORKDIR /workdir
3232

33+
VOLUME /var/lib/apt
34+
3335
ENTRYPOINT ["bash", "-l"]

0 commit comments

Comments
 (0)