Skip to content

Commit 1923834

Browse files
Wironeicanhazstring
authored andcommitted
Use binary-only images for installing Composer
See: https://blog.codito.dev/2022/11/composer-binary-only-docker-images/
1 parent d29a086 commit 1923834

File tree

6 files changed

+42
-8
lines changed

6 files changed

+42
-8
lines changed

.docker/php7.3/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ FROM php:7.3-alpine
22

33
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
44

5-
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
5+
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
66
ENV COMPOSER_ALLOW_SUPERUSER 1
77

88
WORKDIR /docker
99
# Workaround to keep container running
10-
CMD ["tail", "-f", "/dev/null"]
10+
CMD ["tail", "-f", "/dev/null"]

.docker/php7.4/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ FROM php:7.4-alpine
22

33
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
44

5-
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
5+
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
66
ENV COMPOSER_ALLOW_SUPERUSER 1
77

88
WORKDIR /docker
99
# Workaround to keep container running
10-
CMD ["tail", "-f", "/dev/null"]
10+
CMD ["tail", "-f", "/dev/null"]

.docker/php8.0/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM php:8.0.0RC2-alpine
1+
FROM php:8.0-alpine
22

33
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
44

5-
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
5+
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
66
ENV COMPOSER_ALLOW_SUPERUSER 1
77

88
WORKDIR /docker
99
# Workaround to keep container running
10-
CMD ["tail", "-f", "/dev/null"]
10+
CMD ["tail", "-f", "/dev/null"]

.docker/php8.1/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM php:8.1-alpine
2+
3+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
4+
5+
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
6+
ENV COMPOSER_ALLOW_SUPERUSER 1
7+
8+
WORKDIR /docker
9+
# Workaround to keep container running
10+
CMD ["tail", "-f", "/dev/null"]

.docker/php8.2/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM php:8.2.0RC5-alpine
2+
3+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
4+
5+
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
6+
ENV COMPOSER_ALLOW_SUPERUSER 1
7+
8+
WORKDIR /docker
9+
# Workaround to keep container running
10+
CMD ["tail", "-f", "/dev/null"]

docker-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,18 @@ services:
2020
container_name: systemctl-php-8.0
2121
volumes:
2222
- .:/docker:rw
23-
tty: true
23+
tty: true
24+
25+
php8.1:
26+
build: .docker/php8.1
27+
container_name: systemctl-php-8.1
28+
volumes:
29+
- .:/docker:rw
30+
tty: true
31+
32+
php8.2:
33+
build: .docker/php8.2
34+
container_name: systemctl-php-8.2
35+
volumes:
36+
- .:/docker:rw
37+
tty: true

0 commit comments

Comments
 (0)