2024-11-13 17:08:48 +00:00
# Versions
2024-11-22 16:54:26 +00:00
# https://hub.docker.com/r/serversideup/php/tags?name=8.4-fpm-nginx-alpine
2024-11-22 16:42:55 +00:00
ARG SERVERSIDEUP_PHP_VERSION = 8 .4-fpm-nginx-alpine
2024-11-13 17:08:48 +00:00
# https://github.com/minio/mc/releases
2025-07-18 14:25:01 +00:00
ARG MINIO_VERSION = RELEASE.2025-05-21T01-59-54Z
2024-11-13 17:08:48 +00:00
# https://github.com/cloudflare/cloudflared/releases
2025-07-18 14:25:01 +00:00
ARG CLOUDFLARED_VERSION = 2025 .7.0
2024-12-10 16:19:52 +00:00
# https://www.postgresql.org/support/versioning/
2026-01-29 21:24:52 +00:00
# Note: We are using version 18 of the postgres client (while still using postgres 15 for the postgres server) as version 15 has been removed from Alpine 3.23+ https://pkgs.alpinelinux.org/packages?name=postgresql*-client&branch=v3.23&repo=&arch=x86_64&origin=&flagged=&maintainer=
ARG POSTGRES_VERSION = 18
2024-11-13 17:08:48 +00:00
2024-11-13 17:48:56 +00:00
# =================================================================
2024-12-10 10:50:40 +00:00
# Get MinIO client
2024-11-13 17:48:56 +00:00
# =================================================================
2024-11-13 17:12:01 +00:00
FROM minio/mc:${MINIO_VERSION} AS minio-client
2024-11-13 17:48:56 +00:00
# =================================================================
# Final Stage: Production image
# =================================================================
2024-11-13 17:08:48 +00:00
FROM serversideup/php:${SERVERSIDEUP_PHP_VERSION}
2023-09-23 11:34:40 +00:00
2024-11-22 16:42:55 +00:00
ARG USER_ID
ARG GROUP_ID
2023-09-23 11:34:40 +00:00
ARG TARGETPLATFORM
2024-11-13 17:08:48 +00:00
ARG POSTGRES_VERSION
2024-11-13 17:48:56 +00:00
ARG CLOUDFLARED_VERSION
2023-06-15 11:41:25 +00:00
2023-09-23 11:34:40 +00:00
WORKDIR /var/www/html
2024-11-13 17:48:56 +00:00
USER root
2024-11-22 16:42:55 +00:00
RUN docker-php-serversideup-set-id www-data $USER_ID :$GROUP_ID && \
docker-php-serversideup-set-file-permissions --owner $USER_ID :$GROUP_ID --service nginx
2024-11-13 17:48:56 +00:00
# Install PostgreSQL repository and keys
RUN apk add --no-cache gnupg && \
mkdir -p /usr/share/keyrings && \
curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /usr/share/keyrings/postgresql.gpg
# Install system dependencies
RUN apk add --no-cache \
postgresql${ POSTGRES_VERSION } -client \
openssh-client \
git \
git-lfs \
jq \
2024-11-14 11:53:54 +00:00
lsof \
vim
2024-11-13 17:48:56 +00:00
# Configure shell aliases
RUN echo "alias ll='ls -al'" >> /etc/profile && \
echo "alias a='php artisan'" >> /etc/profile && \
echo "alias logs='tail -f storage/logs/laravel.log'" >> /etc/profile
# Install Cloudflared based on architecture
RUN mkdir -p /usr/local/bin && \
if [ " ${ TARGETPLATFORM } " = "linux/amd64" ] ; then \
curl -sSL " https://github.com/cloudflare/cloudflared/releases/download/ ${ CLOUDFLARED_VERSION } /cloudflared-linux-amd64 " -o /usr/local/bin/cloudflared; \
elif [ " ${ TARGETPLATFORM } " = "linux/arm64" ] ; then \
curl -sSL " https://github.com/cloudflare/cloudflared/releases/download/ ${ CLOUDFLARED_VERSION } /cloudflared-linux-arm64 " -o /usr/local/bin/cloudflared; \
fi && \
chmod +x /usr/local/bin/cloudflared
# Configure PHP
2024-12-10 10:50:40 +00:00
COPY docker/development/etc/php/conf.d/zzz-custom-php.ini /usr/local/etc/php/conf.d/zzz-custom-php.ini
2024-12-09 12:34:31 +00:00
ENV PHP_OPCACHE_ENABLE = 0
2024-11-13 17:48:56 +00:00
# Configure Nginx and S6 overlay
2024-12-09 12:34:31 +00:00
COPY docker/development/etc/nginx/conf.d/custom.conf /etc/nginx/conf.d/custom.conf
COPY docker/development/etc/nginx/site-opts.d/http.conf /etc/nginx/site-opts.d/http.conf
COPY --chmod= 755 docker/development/etc/s6-overlay/ /etc/s6-overlay/
2023-04-13 13:48:27 +00:00
2024-11-13 17:48:56 +00:00
RUN mkdir -p /etc/nginx/conf.d && \
chown -R www-data:www-data /etc/nginx && \
chmod -R 755 /etc/nginx
2024-09-12 07:56:48 +00:00
2024-11-13 17:48:56 +00:00
# Install MinIO client
2024-11-13 17:12:01 +00:00
COPY --from= minio-client /usr/bin/mc /usr/bin/mc
2024-11-13 17:48:56 +00:00
RUN chmod +x /usr/bin/mc
# Switch to non-root user
USER www-data