File size: 797 Bytes
215f22a
 
0a384f6
 
215f22a
0a384f6
 
 
 
215f22a
 
20dfadb
 
 
215f22a
0a384f6
215f22a
 
0a384f6
215f22a
 
 
0a384f6
215f22a
 
 
0a384f6
215f22a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;'"]