This repository has been archived by the owner on Mar 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
216 lines (198 loc) · 7.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# Latest version of PHP base image: https://hub.docker.com/_/php?tab=tags
FROM php:8.3.3-fpm-bullseye AS runtime
ARG UNIQUE_ID_FOR_CACHEFROM=runtime
# Latest version of event-extension: https://pecl.php.net/package/event
ARG PHP_EVENT_VERSION=3.1.3
# Latest version of igbinary-extension: https://pecl.php.net/package/igbinary
ARG PHP_IGBINARY_VERSION=3.2.15
# Latest version of redis-extension: https://pecl.php.net/package/redis
ARG PHP_REDIS_VERSION=6.0.2
# Latest version of amqp-extension: https://pecl.php.net/package/amqp
ARG PHP_AMQP_VERSION=2.1.2
ENV SMTPHOST mail
ENV SMTPEHLO localhost
WORKDIR /var/www
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
ca-certificates \
openssl \
curl \
msmtp-mta \
# Dependency of the PHP intl-extension
libicu67 \
# Dependency of the PHP gd-extension
libpng16-16 \
libwebp6 \
libjpeg62-turbo \
libfreetype6 \
# Dependency of PHP zip-extension
libzip4 \
# Dependency of PHP event-extension
libevent-2.1-7 \
libevent-openssl-2.1-7 \
libevent-extra-2.1-7 \
# Dependency of PHP pdo_pgsql-extension
libpq5 \
# Dependency of PHP amqp-extension
librabbitmq4 \
# Dependency of PHP xsl-extension
libxslt1.1 \
# Install packages that are needed for building PHP extensions
&& apt-get install --assume-yes --no-install-recommends \
$PHPIZE_DEPS \
# Dependency of the PHP intl-extension
libicu-dev \
# Dependencies of PHP gd-extension
libpng-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
# Dependency of PHP zip-extension
libzip-dev \
# Dependency of PHP event-extension
libevent-dev \
libssl-dev \
# Dependency of PHP soap-extension
libxml2-dev \
# Dependency of PHP pdo_pgsql-extension
libpq-dev \
# Dependency of PHP amqp-extension
librabbitmq-dev \
# Dependency of PHP xsl-extension
libxslt1-dev \
# Configure PHP gd-extension
&& docker-php-ext-configure gd \
--enable-gd \
--with-jpeg \
--with-freetype \
--with-webp \
# Install PHP extensions
&& docker-php-ext-install -j "$(nproc --all)" \
pdo_mysql \
pdo_pgsql \
intl \
opcache \
pcntl \
gd \
bcmath \
zip \
soap \
xsl \
# Dependency of PHP event-extension
sockets \
&& pecl install "event-$PHP_EVENT_VERSION" \
# Optional dependency of PHP redis-extension
&& pecl install "igbinary-$PHP_IGBINARY_VERSION" \
&& pecl install --configureoptions 'enable-redis-igbinary="yes"' "redis-$PHP_REDIS_VERSION" \
&& pecl install "amqp-$PHP_AMQP_VERSION" \
&& docker-php-ext-enable --ini-name docker-php-ext-zz-custom.ini \
event \
igbinary \
redis \
amqp \
&& cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
# Purge packages that where only needed for building php extensions
&& apt-get purge --assume-yes \
$PHPIZE_DEPS \
libicu-dev \
libpng-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libzip-dev \
libevent-dev \
libssl-dev \
libxml2-dev \
libpq-dev \
librabbitmq-dev \
# Cleanup
&& rm -rf /var/www/* \
&& apt-get autoremove --assume-yes \
&& apt-get clean --assume-yes \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
COPY files /
FROM runtime AS builder
ARG UNIQUE_ID_FOR_CACHEFROM=builder
# Latest version of Phive: https://api.github.com/repos/phar-io/phive/releases/latest
ARG PHIVE_VERSION=0.15.2
# Latest version of Composer: https://getcomposer.org/download
ARG COMPOSER_VERSION=2.7.1
# Latest version of Xdebug: https://github.com/xdebug/xdebug/tags or https://pecl.php.net/package/xdebug
ARG XDEBUG_VERSION=3.3.1
# Latest version of pcov: https://github.com/krakjoe/pcov/tags or https://pecl.php.net/package/pcov
ARG PCOV_VERSION=1.0.11
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
# Needed for xdebug extension configuration
$PHPIZE_DEPS \
vim \
git \
unzip \
sqlite3 \
wait-for-it \
# Needed for phive:
gnupg \
# Install Phive
&& curl -fsSLo /usr/local/bin/phive "https://github.com/phar-io/phive/releases/download/$PHIVE_VERSION/phive-$PHIVE_VERSION.phar" \
&& curl -fsSLo /tmp/phive.phar.asc "https://github.com/phar-io/phive/releases/download/$PHIVE_VERSION/phive-$PHIVE_VERSION.phar.asc" \
&& gpg --keyserver keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 \
&& gpg --verify /tmp/phive.phar.asc /usr/local/bin/phive \
&& chmod +x /usr/local/bin/phive \
&& phive update-repository-list \
# Install Composer using Phive
&& phive install --global composer:$COMPOSER_VERSION --trust-gpg-keys CBB3D576F2A0946F \
&& rm -rf /root/.phive \
# Install Xdebug PHP extension
&& pecl install "xdebug-$XDEBUG_VERSION" \
&& docker-php-ext-enable xdebug \
# Install pcov PHP extension
&& pecl install "pcov-$PCOV_VERSION" \
&& docker-php-ext-enable pcov \
&& cp "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" \
# Cleanup
&& apt-get purge --assume-yes $PHPIZE_DEPS \
&& apt-get autoremove --assume-yes \
&& apt-get clean --assume-yes \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
FROM builder AS builder_nodejs
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG UNIQUE_ID_FOR_CACHEFROM=builder_nodejs
# Latest version of Node.js: https://nodejs.org
ARG NODE_MAJOR=20
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
gcc \
g++ \
make \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
nodejs \
&& npm uninstall --global npm \
&& corepack install --global --all \
&& corepack enable npm yarn pnpm \
&& apt-get autoremove --assume-yes \
&& apt-get clean --assume-yes \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
FROM builder_nodejs AS vscode
ARG UNIQUE_ID_FOR_CACHEFROM=vscode
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
openssh-client \
sudo \
# VSCode Live Share Extension dependencies
libicu67 \
libkrb5-3 \
zlib1g \
gnome-keyring \
libsecret-1-0 \
desktop-file-utils \
x11-utils \
&& apt-get autoremove --assume-yes \
&& apt-get clean --assume-yes \
&& rm -rf /var/lib/apt/lists/*