Skip to content

Commit 135f656

Browse files
authored
Use Alpine Linux for the Docker image (#77)
1 parent e67fad3 commit 135f656

4 files changed

Lines changed: 61 additions & 31 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ You can start the containers with :
277277
278278
**⚠ Do not forget to create the database the first time you run the container** :
279279
280-
docker exec -it davis bash -c "APP_ENV=prod bin/console doctrine:schema:create --no-interaction"
280+
docker exec -it davis sh -c "APP_ENV=prod bin/console doctrine:schema:create --no-interaction"
281281
282282
Then, head up to `http://<YOUR_DOCKER_IP>:9000` to see the status display :
283283

docker/Dockerfile

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,61 @@
1-
FROM php:8.1-fpm
1+
FROM php:8.1-fpm-alpine
22

33
LABEL org.opencontainers.image.authors="tchap@tchap.me"
44

5-
# Run update, and gets basic packages
6-
RUN apt-get update && apt-get install -y --no-install-recommends \
7-
curl \
8-
unzip \
9-
# These are for IMAP
10-
libc-client-dev libkrb5-dev \
11-
# This one if for LDAP
12-
libldap2-dev \
13-
# This one if for GD (map image in mail)
14-
libpng-dev libjpeg-dev libfreetype6-dev \
15-
# There are for php-intl
16-
zlib1g-dev libicu-dev g++ \
17-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
18-
19-
# Configure PHP extensions
5+
# Run update, and gets basic packages and packages for runtime
6+
RUN apk --no-progress --update add --no-cache \
7+
curl unzip \
8+
# These are for php-intl
9+
icu-libs \
10+
# This one is for IMAP (to provide libc-client.so)
11+
c-client \
12+
# This one for LDAP
13+
libldap \
14+
# These are for GD (map image in mail)
15+
freetype \
16+
libjpeg-turbo \
17+
libpng \
18+
# This is for PostgreSQL
19+
libpq
20+
21+
# Intl support
22+
RUN apk --update --virtual build-deps-intl add --no-cache icu-dev \
23+
&& docker-php-ext-install intl \
24+
&& apk del build-deps-intl \
25+
&& rm -rf /tmp/*
26+
27+
# PDO: MySQL
2028
RUN docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
2129
&& docker-php-ext-install pdo_mysql
2230

23-
RUN docker-php-ext-configure ldap \
24-
&& docker-php-ext-install ldap
31+
# PDO: PostgreSQL
32+
RUN apk --update --virtual build-deps-pg add --no-cache libpq-dev \
33+
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
34+
&& docker-php-ext-install pgsql pdo_pgsql \
35+
&& apk del build-deps-pg \
36+
&& rm -rf /tmp/*
37+
38+
# GD (map image in mail)
39+
RUN apk --update --virtual build-deps-gd add --no-cache freetype-dev libjpeg-turbo-dev libpng-dev \
40+
&& docker-php-ext-configure gd --with-freetype \
41+
&& docker-php-ext-install gd \
42+
&& docker-php-ext-enable gd \
43+
&& apk del build-deps-gd \
44+
&& rm -rf /tmp/*
2545

26-
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
27-
&& docker-php-ext-install imap
28-
29-
RUN docker-php-ext-configure gd --with-freetype \
30-
&& docker-php-ext-install gd
31-
32-
RUN docker-php-ext-install intl \
33-
&& docker-php-source delete
46+
# LDAP auth support
47+
RUN apk --update --virtual build-deps-ldap add --no-cache openldap-dev \
48+
&& docker-php-ext-configure ldap \
49+
&& docker-php-ext-install ldap \
50+
&& apk del build-deps-ldap \
51+
&& rm -rf /tmp/*
52+
53+
# IMAP auth support
54+
RUN apk --update --virtual build-deps-imap add --no-cache imap-dev openssl-dev krb5-dev \
55+
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
56+
&& docker-php-ext-install imap \
57+
&& apk del build-deps-imap \
58+
&& rm -rf /tmp/*
3459

3560
# Set timezone correctly
3661
RUN echo 'date.timezone = "Europe/Paris"' > /usr/local/etc/php/conf.d/timezone.ini
@@ -43,4 +68,8 @@ WORKDIR /var/www/davis
4368
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
4469
RUN APP_ENV=prod composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader
4570

71+
# Cleanup (only useful when using --squash)
72+
RUN docker-php-source delete
73+
RUN rm -rf /usr/local/bin/composer
74+
4675
RUN chown -R www-data:www-data var

docker/docker-compose.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
version: "3.7"
2+
name: "davis-docker"
23

34
services:
45

56
nginx:
6-
image: nginx:1.20.0-alpine
7+
image: nginx:1.23-alpine
78
container_name: nginx
89
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
910
depends_on:
@@ -17,7 +18,7 @@ services:
1718
- 9000:80
1819

1920
mysql:
20-
image: mariadb:10.4.18
21+
image: mariadb:10.6.10
2122
container_name: mysql
2223
environment:
2324
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
@@ -37,7 +38,7 @@ services:
3738
container_name: davis
3839
environment:
3940
- APP_ENV=prod
40-
- DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
41+
- DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}?serverVersion=mariadb-10.6.10&charset=utf8mb4
4142
- MAILER_DSN=smtp://${MAIL_USERNAME}:${MAIL_PASSWORD}@${MAIL_HOST}:${MAIL_PORT}
4243
- ADMIN_LOGIN=${ADMIN_LOGIN}
4344
- ADMIN_PASSWORD=${ADMIN_PASSWORD}

src/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
final class Version
66
{
7-
public const VERSION = '2.0.2';
7+
public const VERSION = '2.1.0';
88
}

0 commit comments

Comments
 (0)