Skip to content

Commit e69ea17

Browse files
committed
chore: Add docker file and compose
1 parent 11fa685 commit e69ea17

2 files changed

Lines changed: 90 additions & 5 deletions

File tree

Dockerfile

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# the different stages of this Dockerfile are meant to be built into separate images
2+
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
3+
# https://docs.docker.com/compose/compose-file/#target
4+
5+
6+
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
7+
ARG PHP_VERSION=8.2
8+
ARG NGINX_VERSION=1.21
9+
10+
11+
# "php" stage
12+
FROM php:${PHP_VERSION}-fpm-alpine AS bdf
13+
14+
# persistent / runtime deps
15+
RUN apk add --no-cache \
16+
acl \
17+
fcgi \
18+
file \
19+
gettext \
20+
git \
21+
freetype libpng libjpeg-turbo \
22+
bash \
23+
vim \
24+
;
25+
26+
ARG APCU_VERSION=5.1
27+
RUN set -eux; \
28+
apk add --no-cache --virtual .build-deps \
29+
$PHPIZE_DEPS \
30+
icu-dev \
31+
libzip-dev \
32+
zlib-dev \
33+
freetype-dev libpng-dev libjpeg-turbo-dev \
34+
gmp-dev \
35+
libxml2-dev \
36+
; \
37+
\
38+
docker-php-ext-configure zip; \
39+
docker-php-ext-configure gd \
40+
--with-freetype \
41+
--with-jpeg; \
42+
docker-php-ext-install -j$(nproc) \
43+
intl \
44+
pdo_mysql \
45+
zip \
46+
pcntl \
47+
gd \
48+
gmp \
49+
bcmath \
50+
soap \
51+
# sockets \
52+
mysqli \
53+
; \
54+
pecl install \
55+
apcu-${APCU_VERSION} \
56+
redis \
57+
; \
58+
pecl clear-cache; \
59+
docker-php-ext-enable \
60+
# apcu \
61+
opcache \
62+
pdo_mysql \
63+
redis \
64+
; \
65+
\
66+
runDeps="$( \
67+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
68+
| tr ',' '\n' \
69+
| sort -u \
70+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
71+
)"; \
72+
apk add --no-cache --virtual .api-phpexts-rundeps $runDeps; \
73+
\
74+
apk del .build-deps
75+
76+
RUN apk --no-cache update && apk --no-cache add bash
77+
RUN wget https://get.symfony.com/cli/installer -O - | bash && mv /root/.symfony5/bin/symfony /usr/local/bin/symfony
78+
79+
COPY --from=composer:2.8 /usr/bin/composer /usr/bin/composer
80+
81+
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
82+
ENV COMPOSER_ALLOW_SUPERUSER=1
83+
ENV PATH="${PATH}:/root/.composer/vendor/bin"
84+
85+
WORKDIR /srv/bdf
86+
87+
CMD ["php-fpm"]

docker-compose.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
version: '3.5'
2-
31
services:
42
bdf:
53
build:
6-
context: ..
7-
dockerfile: docker/Dockerfile
4+
context: .
5+
dockerfile: Dockerfile
86
image: local/bdf:latest
97
volumes:
10-
- ../:/srv/bdf
8+
- ./:/srv/bdf
119
environment:
1210
- APP_ENV=dev
1311

0 commit comments

Comments
 (0)