Advanced-Php / Dockerfile
Emalawi19's picture
Update Dockerfile
0a384f6 verified
Raw
History Blame Contribute Delete
797 Bytes
FROM php:8.2-fpm-alpine
# 1. Install Nginx and the required system libraries for Zip
RUN apk add --no-cache nginx libzip-dev zip unzip
# 2. Use the official Docker PHP helper to install the zip extension
RUN docker-php-ext-install zip
# Create the non-root user
RUN adduser -D -u 1000 user
# Setup required directories and permissions
RUN mkdir -p /var/cache/nginx /var/run/nginx /var/lib/nginx/logs /tmp/sites \
&& chown -R user:user /var/cache/nginx /var/run/nginx /var/lib/nginx /var/log/nginx /tmp/sites
# Copy configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Setup working directory and copy files
WORKDIR /app
COPY --chown=user:user . /app
# Switch to the non-root user
USER user
EXPOSE 7860
# Start PHP-FPM and Nginx
CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]