tasks/docker/Dockerfile
Emmanuel BENOîT 5110ded7e5
feat: support running using Docker Compose
This commit adds a Docker Compose file which will run the application
using docker. The application is fronted by Traefik, and runs using
PHP-fpm. nginx is used to accept queries from Traefik and relay them to
the PHP-fpm containers (Traefik doesn't support FastCGI directly).
Sessions are shared between the various PHP containers using memcached.

Part of this work is based on [this repo](https://github.com/wandersonwhcr/docker-nginx-php-fpm)
2025-01-05 21:09:27 +01:00

37 lines
1.1 KiB
Docker

# syntax=docker/dockerfile:1.7-labs
ARG PHP_VERSION=8.3
ARG POSTGRESQL_VERSION=17
#
# Application image
#
FROM php:${PHP_VERSION}-fpm-alpine AS application
RUN <<EOF
set -e
apk add --no-cache fcgi unzip postgresql-dev libmemcached-dev \
libmemcached autoconf pkgconfig g++ zlib-dev make
docker-php-ext-install pgsql pdo pdo_pgsql
pecl install memcached
docker-php-ext-enable memcached
mkdir -p /var/www/tasks
echo "pm.status_path = /status" >> /usr/local/etc/php-fpm.d/zz-docker.conf
echo "chdir = /var/www/tasks/site" >> /usr/local/etc/php-fpm.d/zz-docker.conf
curl --silent --remote-name https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/v0.5.0/php-fpm-healthcheck
install --owner root --group root --mode 755 php-fpm-healthcheck /usr/local/bin/php-fpm-healthcheck
rm -rf php-fpm-healthcheck
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
EOF
HEALTHCHECK --interval=5s \
CMD php-fpm-healthcheck || exit 1
COPY --parents site includes arse /var/www/tasks/
#
# Database image
#
FROM postgres:${POSTGRESQL_VERSION} AS database
RUN mkdir /opt/tasks
COPY --parents database.sql database /opt/tasks/