Skip to content

Commit c537d64

Browse files
authored
Merge pull request #78 from WyriHaximusNet/add-debian-based-images
Add Debian based images
2 parents 9aaaa29 + dce8838 commit c537d64

File tree

14 files changed

+400
-26
lines changed

14 files changed

+400
-26
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ jobs:
2323
- id: supported-alpine-versions
2424
name: Generate Alpine
2525
uses: wyrihaximus/github-action-supported-alpine-linux-versions@v1
26+
supported-debian-versions:
27+
name: Supported Debian versions
28+
runs-on: ubuntu-latest
29+
container:
30+
image: wyrihaximusnet/php:7.4-nts-alpine3.12-root
31+
outputs:
32+
debian: ${{ steps.supported-debian-versions.outputs.versions }}
33+
steps:
34+
- uses: actions/checkout@v1
35+
- id: supported-debian-versions
36+
name: Generate Debian
37+
uses: wyrihaximus/github-action-supported-debian-linux-versions@v1
2638
supported-php-versions:
2739
name: Supported PHP versions
2840
runs-on: ubuntu-latest
@@ -62,6 +74,7 @@ jobs:
6274
runs-on: ubuntu-latest
6375
needs:
6476
- supported-alpine-versions
77+
- supported-debian-versions
6578
- supported-php-versions
6679
outputs:
6780
image: ${{ steps.image-matrix.outputs.image }}
@@ -78,6 +91,7 @@ jobs:
7891
php utils/all-images.php
7992
env:
8093
ALPINE: ${{ needs.supported-alpine-versions.outputs.alpine }}
94+
DEBIAN: ${{ needs.supported-debian-versions.outputs.debian }}
8195
PHP: ${{ needs.supported-php-versions.outputs.php }}
8296
lint:
8397
name: Linting Dockerfile-${{ matrix.type }}
@@ -141,18 +155,24 @@ jobs:
141155
image: ${{ fromJson(needs.image-matrix.outputs.image) }}
142156
steps:
143157
- uses: actions/checkout@v2
158+
if: contains(matrix.image, 'alpine')
144159
- name: Install clair-scanner
160+
if: contains(matrix.image, 'alpine')
145161
run: |
146162
sudo curl -L https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 -o /usr/local/bin/clair-scanner
147163
sudo chmod +x /usr/local/bin/clair-scanner
148164
- name: Download Images
165+
if: contains(matrix.image, 'alpine')
149166
uses: actions/download-artifact@v2
150167
with:
151168
name: docker-image-${{ matrix.image }}
152169
path: ./docker-image
153170
- run: docker load --input ./docker-image/image.tar
171+
if: contains(matrix.image, 'alpine')
154172
- run: mkdir -p "./clair/${DOCKER_IMAGE}"
173+
if: contains(matrix.image, 'alpine')
155174
- run: make ci-scan-vulnerability
175+
if: contains(matrix.image, 'alpine')
156176
test:
157177
name: Testing "${{ matrix.image }}"
158178
needs:

.hadolint.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ ignored:
99
- DL3013 # So we can install the latest docker-compose
1010
- SC2126
1111
- DL4006
12-
- DL3003
12+
- DL3003
13+
- DL3005
14+
- DL3008
15+
- DL3009
16+
- DL3014
17+
- DL3015

Dockerfile-nts renamed to Dockerfile-nts-alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ FROM nts-root AS nts-dev-root
8383
RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev
8484

8585
# Install docker help scripts
86-
COPY src/php/utils/docker/ /usr/local/bin/
86+
COPY src/php/utils/docker/alpine/ /usr/local/bin/
8787

8888
RUN apk add --no-cache \
8989
make \

Dockerfile-nts-debian

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# syntax=docker/dockerfile:experimental
2+
FROM php:7.4-cli-buster AS build-uv
3+
RUN apt-get update && \
4+
yes | apt-get install $PHPIZE_DEPS git libuv1-dev && \
5+
git clone https://github.com/bwoebi/php-uv uv
6+
WORKDIR /uv
7+
RUN git fetch \
8+
&& git pull \
9+
&& phpize \
10+
&& ./configure \
11+
&& make install \
12+
&& EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
13+
cp "$EXTENSION_DIR/uv.so" /uv.so
14+
RUN sha256sum /uv.so
15+
16+
FROM php:7.4-cli-buster AS nts-root
17+
18+
# Build-time metadata as defined at http://label-schema.org
19+
ARG BUILD_DATE
20+
ARG VCS_REF
21+
LABEL org.label-schema.build-date=$BUILD_DATE \
22+
org.label-schema.name="wyrihaximusnet/php" \
23+
org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \
24+
org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \
25+
org.label-schema.vcs-ref=$VCS_REF \
26+
org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \
27+
org.label-schema.vendor="WyriHaximus.net" \
28+
org.label-schema.schema-version="1.0"
29+
30+
RUN set -x \
31+
&& addgroup --gid 1000 app \
32+
&& adduser --uid 1000 --gid 1000 --disabled-password app \
33+
&& touch /.you-are-in-a-wyrihaximus.net-php-docker-image
34+
35+
COPY --from=build-uv /uv.so /uv.so
36+
37+
# Patch CVE-2018-14618 (curl), CVE-2018-16842 (libxml2), CVE-2019-1543 (openssl)
38+
RUN apt-get update && \
39+
yes | apt-get upgrade curl libxml2 openssl
40+
41+
# Install docker help scripts
42+
COPY src/php/utils/docker/debian/ /usr/local/bin/
43+
44+
COPY src/php/conf/ /usr/local/etc/php/conf.d/
45+
COPY src/php/cli/conf/*.ini /usr/local/etc/php/conf.d/
46+
47+
RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
48+
mv /*.so "$EXTENSION_DIR/" && \
49+
apt-get update && \
50+
yes | apt-get upgrade && \
51+
yes | apt-get install \
52+
libfreetype6-dev \
53+
libjpeg62-turbo-dev \
54+
libpng-dev \
55+
libgmp-dev \
56+
zlib1g-dev \
57+
libpq-dev \
58+
libzip-dev \
59+
libuv1-dev \
60+
make \
61+
git \
62+
openssh-client \
63+
bash \
64+
coreutils \
65+
procps \
66+
libvips-dev \
67+
git \
68+
wget \
69+
gdb \
70+
$PHPIZE_DEPS \
71+
&& (docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ || docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/) \
72+
&& docker-php-ext-install -j$(nproc) gd pcntl pgsql pdo pdo_pgsql bcmath zip gmp iconv \
73+
&& pecl install vips \
74+
&& docker-php-ext-enable uv \
75+
&& docker-php-ext-enable vips \
76+
&& wget -O - https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /bin/wait-for \
77+
&& yes | apt-get purge wget $PHPIZE_DEPS \
78+
&& chmod +x /bin/wait-for \
79+
&& rm -rf /var/cache/apk/* \
80+
&& rm -rf /tmp/*
81+
82+
# Install shush
83+
COPY src/php/utils/install-shush /usr/local/bin/
84+
RUN install-shush && rm -rf /usr/local/bin/install-shush
85+
86+
STOPSIGNAL SIGTERM
87+
88+
ENTRYPOINT ["/usr/local/bin/shush", "exec", "docker-php-entrypoint"]
89+
90+
## nts-DEV STAGE ##
91+
FROM nts-root AS nts-dev-root
92+
93+
RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev
94+
95+
# Install docker help scripts
96+
COPY src/php/utils/docker/ /usr/local/bin/
97+
98+
RUN apt-get update \
99+
&& yes | apt-get install \
100+
make \
101+
git \
102+
openssh-client \
103+
bash \
104+
strace \
105+
# Install Xdebug and development specific configuration
106+
&& docker-php-dev-mode xdebug \
107+
&& docker-php-dev-mode config \
108+
# Forcefully clear API cache
109+
&& rm -rf /var/cache/apk/*
110+
111+
# Install composer
112+
COPY src/php/utils/install-composer /usr/local/bin/
113+
RUN apt-get update \
114+
&& yes | apt-get install wget \
115+
&& install-composer \
116+
&& yes | apt-get purge wget \
117+
&& rm -rf /usr/local/bin/install-composer
118+
119+
# Change entrypoint back to the default because we don't need shush in development
120+
ENTRYPOINT ["docker-php-entrypoint"]
121+
122+
## nts-DEV stage ##
123+
FROM nts-dev-root AS nts-dev
124+
125+
USER app
126+
127+
## nts stage ##
128+
FROM nts-root AS nts
129+
130+
USER app

Dockerfile-zts renamed to Dockerfile-zts-alpine

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ COPY --from=build-uv /uv.so /uv.so
3434
RUN apk upgrade --no-cache curl libxml2 openssl
3535

3636
# Install docker help scripts
37-
COPY src/php/utils/docker/ /usr/local/bin/
37+
COPY src/php/utils/docker/alpine/ /usr/local/bin/
3838

3939
COPY src/php/conf/ /usr/local/etc/php/conf.d/
4040
COPY src/php/cli/conf/*.ini /usr/local/etc/php/conf.d/
@@ -90,7 +90,7 @@ FROM zts-root AS zts-dev-root
9090
RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev
9191

9292
# Install docker help scripts
93-
COPY src/php/utils/docker/ /usr/local/bin/
93+
COPY src/php/utils/docker/alpine/ /usr/local/bin/
9494

9595
RUN apk add --no-cache \
9696
make \

Dockerfile-zts-debian

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# syntax=docker/dockerfile:experimental
2+
FROM php:7.4-zts-buster AS build-parallel
3+
RUN apt-get update && \
4+
yes | apt-get install $PHPIZE_DEPS git
5+
RUN git clone https://github.com/krakjoe/parallel
6+
WORKDIR /parallel
7+
RUN git fetch \
8+
&& git pull \
9+
&& phpize \
10+
&& ./configure \
11+
&& make install \
12+
&& EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
13+
cp "$EXTENSION_DIR/parallel.so" /parallel.so
14+
RUN sha256sum /parallel.so
15+
16+
FROM php:7.4-zts-buster AS build-uv
17+
RUN apt-get update && \
18+
yes | apt-get install $PHPIZE_DEPS git libuv1-dev && \
19+
git clone https://github.com/bwoebi/php-uv uv
20+
WORKDIR /uv
21+
RUN git fetch \
22+
&& git pull \
23+
&& phpize \
24+
&& ./configure \
25+
&& make install \
26+
&& EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
27+
cp "$EXTENSION_DIR/uv.so" /uv.so
28+
RUN sha256sum /uv.so
29+
30+
FROM php:7.4-zts-buster AS zts-root
31+
32+
# Build-time metadata as defined at http://label-schema.org
33+
ARG BUILD_DATE
34+
ARG VCS_REF
35+
LABEL org.label-schema.build-date=$BUILD_DATE \
36+
org.label-schema.name="wyrihaximusnet/php" \
37+
org.label-schema.description="Opinionated ReactPHP optimised PHP Docker images" \
38+
org.label-schema.url="https://github.com/wyrihaximusnet/docker-php" \
39+
org.label-schema.vcs-ref=$VCS_REF \
40+
org.label-schema.vcs-url="https://github.com/wyrihaximusnet/docker-php" \
41+
org.label-schema.vendor="WyriHaximus.net" \
42+
org.label-schema.schema-version="1.0"
43+
44+
RUN set -x \
45+
&& addgroup --gid 1000 app \
46+
&& adduser --uid 1000 --gid 1000 --disabled-password app \
47+
&& touch /.you-are-in-a-wyrihaximus.net-php-docker-image
48+
49+
COPY --from=build-parallel /parallel.so /parallel.so
50+
COPY --from=build-uv /uv.so /uv.so
51+
52+
# Patch CVE-2018-14618 (curl), CVE-2018-16842 (libxml2), CVE-2019-1543 (openssl)
53+
RUN apt-get update && \
54+
yes | apt-get upgrade curl libxml2 openssl
55+
56+
# Install docker help scripts
57+
COPY src/php/utils/docker/debian/ /usr/local/bin/
58+
59+
COPY src/php/conf/ /usr/local/etc/php/conf.d/
60+
COPY src/php/cli/conf/*.ini /usr/local/etc/php/conf.d/
61+
62+
RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \
63+
mv /*.so "$EXTENSION_DIR/" && \
64+
apt-get update && \
65+
yes | apt-get upgrade && \
66+
yes | apt-get install \
67+
libfreetype6-dev \
68+
libjpeg62-turbo-dev \
69+
libpng-dev \
70+
libgmp-dev \
71+
zlib1g-dev \
72+
libpq-dev \
73+
libzip-dev \
74+
libuv1-dev \
75+
make \
76+
git \
77+
openssh-client \
78+
bash \
79+
coreutils \
80+
procps \
81+
libvips-dev \
82+
git \
83+
wget \
84+
gdb \
85+
$PHPIZE_DEPS \
86+
&& (docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ || docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/) \
87+
&& docker-php-ext-install -j$(nproc) gd pcntl pgsql pdo pdo_pgsql bcmath zip gmp iconv \
88+
&& pecl install vips \
89+
&& docker-php-ext-enable parallel \
90+
&& docker-php-ext-enable uv \
91+
&& docker-php-ext-enable vips \
92+
&& wget -O - https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /bin/wait-for \
93+
&& yes | apt-get purge wget $PHPIZE_DEPS \
94+
&& chmod +x /bin/wait-for \
95+
&& rm -rf /var/cache/apk/* \
96+
&& rm -rf /tmp/*
97+
98+
# Install shush
99+
COPY src/php/utils/install-shush /usr/local/bin/
100+
RUN install-shush && rm -rf /usr/local/bin/install-shush
101+
102+
STOPSIGNAL SIGTERM
103+
104+
ENTRYPOINT ["/usr/local/bin/shush", "exec", "docker-php-entrypoint"]
105+
106+
## ZTS-DEV STAGE ##
107+
FROM zts-root AS zts-dev-root
108+
109+
RUN touch /.you-are-in-a-wyrihaximus.net-php-docker-image-dev
110+
111+
# Install docker help scripts
112+
COPY src/php/utils/docker/ /usr/local/bin/
113+
114+
RUN apt-get update \
115+
&& yes | apt-get install \
116+
make \
117+
git \
118+
openssh-client \
119+
bash \
120+
strace \
121+
# Install Xdebug and development specific configuration
122+
&& docker-php-dev-mode xdebug \
123+
&& docker-php-dev-mode config \
124+
# Forcefully clear API cache
125+
&& rm -rf /var/cache/apk/*
126+
127+
# Install composer
128+
COPY src/php/utils/install-composer /usr/local/bin/
129+
RUN apt-get update \
130+
&& yes | apt-get install wget \
131+
&& install-composer \
132+
&& yes | apt-get purge wget \
133+
&& rm -rf /usr/local/bin/install-composer
134+
135+
# Change entrypoint back to the default because we don't need shush in development
136+
ENTRYPOINT ["docker-php-entrypoint"]
137+
138+
## ZTS-DEV stage ##
139+
FROM zts-dev-root AS zts-dev
140+
141+
USER app
142+
143+
## ZTS stage ##
144+
FROM zts-root AS zts
145+
146+
USER app

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ci-docker-login:
2323
docker login $$DOCKER_REGISTRY --username $$DOCKER_USER --password $$DOCKER_PASSWORD
2424

2525
lint:
26-
docker run -v ${current_dir}:/project:ro --workdir=/project --rm -it hadolint/hadolint:latest-debian hadolint /project/Dockerfile-nts /project/Dockerfile-zts
26+
docker run -v ${current_dir}:/project:ro --workdir=/project --rm -it hadolint/hadolint:latest-debian hadolint /project/Dockerfile-*
2727

2828
build-all:
2929
PHP=$(shell docker run --rm wyrihaximusgithubactions/supported-php-versions:v1 | php -r 'echo explode("::set-output name=versions::", stream_get_contents(STDIN))[1];') \

0 commit comments

Comments
 (0)