|
1 | | -# Based off Dockerfile from TrafeX/docker-php-nginx (https://github.com/TrafeX/docker-php-nginx). |
2 | | -# Credit to TrafeX for the original implementation. |
3 | | - |
4 | | -FROM php:8.3.11-fpm-alpine3.20 |
5 | | -LABEL org.opencontainers.image.title="Winter CMS Docker Image - PHP 8.3.11 / Alpine 3.20" |
| 1 | +FROM dunglas/frankenphp:1.9-php8.4-trixie |
| 2 | +LABEL org.opencontainers.image.title="Winter CMS Docker Image - PHP 8.4 with FrankenPHP" |
6 | 3 | LABEL org.opencontainers.image.description="Builds and deploys a Winter CMS project using Docker." |
7 | 4 | LABEL org.opencontainers.image.source=https://github.com/wintercms/docker |
8 | 5 |
|
9 | | -# Install PHP extension script |
10 | | -ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ |
| 6 | +ARG USER=winter |
| 7 | +ARG WINTER_TAG=v1.2.8 |
11 | 8 |
|
12 | | -# Install PHP extensions |
13 | | -RUN chmod +x /usr/local/bin/install-php-extensions && \ |
14 | | - install-php-extensions \ |
| 9 | +RUN \ |
| 10 | + # Install Microsoft packages key for SQL Server support |
| 11 | + curl -sSL -o /tmp/packages-microsoft-prod.deb https://packages.microsoft.com/config/debian/13/packages-microsoft-prod.deb \ |
| 12 | + && dpkg -i /tmp/packages-microsoft-prod.deb \ |
| 13 | + && rm /tmp/packages-microsoft-prod.deb \ |
| 14 | + && mkdir -p /opt/microsoft/msodbcsql18/ \ |
| 15 | + && touch /opt/microsoft/msodbcsql18/ACCEPT_EULA \ |
| 16 | + && apt update \ |
| 17 | + # Install PHP extensions |
| 18 | + && install-php-extensions \ |
15 | 19 | gd \ |
16 | | - gettext \ |
17 | | - imap \ |
18 | 20 | intl \ |
19 | 21 | memcached \ |
20 | | - opcache \ |
21 | 22 | pdo_mysql \ |
22 | 23 | pdo_pgsql \ |
23 | 24 | pdo_sqlsrv \ |
24 | 25 | pdo_odbc \ |
25 | 26 | redis \ |
26 | | - zip |
27 | | - |
28 | | -# Install other software |
29 | | -RUN apk add --no-cache \ |
30 | | - curl \ |
31 | | - git \ |
32 | | - nginx \ |
33 | | - supervisor \ |
34 | | - tar \ |
35 | | - unzip \ |
36 | | - zip |
37 | | - |
| 27 | + zip \ |
| 28 | + # Install additional software for Composer |
| 29 | + && apt update \ |
| 30 | + && apt install -y \ |
| 31 | + git \ |
| 32 | + unzip \ |
| 33 | + tar \ |
| 34 | + wget \ |
| 35 | + # Clean up |
| 36 | + && apt clean \ |
| 37 | + && rm -rf /var/lib/apt/lists/* |
38 | 38 |
|
39 | 39 | # Install Composer |
40 | 40 | COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer |
41 | 41 |
|
42 | | -# Add configuration |
43 | | -COPY config/nginx/nginx.conf /etc/nginx/nginx.conf |
44 | | -COPY config/nginx/default.conf /etc/nginx/conf.d/default.conf |
45 | | -COPY config/php-fpm/php.ini /usr/local/etc/php/conf.d/docker-fpm.ini |
46 | | -COPY config/php-fpm/docker.conf /usr/local/etc/php-fpm.d/docker.conf |
47 | | -COPY config/php-fpm/pool.conf /usr/local/etc/php-fpm.d/www.conf |
48 | | -COPY config/supervisor/supervisor.conf /etc/supervisor/conf.d/supervisord.conf |
49 | | -RUN rm -f /usr/local/etc/php-fpm.d/zz-docker.conf |
| 42 | +# Setup Winter user and download Winter |
| 43 | +RUN \ |
| 44 | + groupadd -g 10000 -r ${USER} \ |
| 45 | + && useradd -m -d /home/winter -u 10000 -g 10000 -s /bin/bash ${USER} \ |
| 46 | + # Add additional capability to bind to port 80 and 443 |
| 47 | + && setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp \ |
| 48 | + # Give write access to /config/caddy and /data/caddy |
| 49 | + && chown -R ${USER}:${USER} /config/caddy /data/caddy \ |
| 50 | + && mkdir /winter \ |
| 51 | + && cd /winter \ |
| 52 | + && composer create-project --no-progress --no-interaction wintercms/winter /winter "${WINTER_TAG}" \ |
| 53 | + && chown -R ${USER}:${USER} /winter |
50 | 54 |
|
51 | | -# Create bootstrap directory and file |
52 | | -COPY bootstrap /bootstrap |
53 | | -COPY bootstrap.sh /bootstrap.sh |
54 | | - |
55 | | -# Set the working directory |
56 | | -RUN mkdir -p /winter |
57 | 55 | WORKDIR /winter |
| 56 | +USER winter |
58 | 57 |
|
59 | | -# Make sure files/folders needed by the processes are accessable when they run under the nobody user |
60 | | -RUN chown -R nobody:nobody /winter /bootstrap /run /var/lib/nginx /var/log/nginx |
61 | | - |
62 | | -# Switch to use a non-root user from here on |
63 | | -USER nobody |
64 | | - |
65 | | -# Expose the port Nginx is reachable on |
66 | | -EXPOSE 8080 |
| 58 | +ENV SERVER_NAME=":8000" |
| 59 | +ENV SERVER_ROOT="/winter/public" |
| 60 | +ENV APP_DEBUG="false" |
| 61 | +ENV APP_URL="http://localhost:8000" |
| 62 | +ENV ACTIVE_THEME="demo" |
| 63 | +ENV BACKEND_URI="backend" |
| 64 | +ENV ROUTES_CACHE="true" |
| 65 | +ENV ASSET_CACHE="true" |
67 | 66 |
|
68 | | -CMD ["/bootstrap.sh"] |
| 67 | +COPY entrypoint.sh /entrypoint.sh |
| 68 | +COPY config/php.ini /usr/local/etc/php/conf.d/winter.ini |
69 | 69 |
|
70 | | -# Configure a healthcheck to validate that everything is up&running |
71 | | -HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping || exit 1 |
| 70 | +CMD ["--config", "/etc/frankenphp/Caddyfile", "--adapter", "caddyfile"] |
| 71 | +ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments