Emalawi19 commited on
Commit
20dfadb
·
verified ·
1 Parent(s): d225eff

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -13
Dockerfile CHANGED
@@ -1,28 +1,20 @@
1
- # Use PHP 8.2 with FPM and Alpine Linux for a small footprint
2
  FROM php:8.2-fpm-alpine
3
 
4
- # Install Nginx
5
- RUN apk add --no-cache nginx
6
 
7
- # Create a non-root user (Hugging Face requires user ID 1000)
8
  RUN adduser -D -u 1000 user
9
 
10
- # Configure Nginx for non-root execution
11
- RUN mkdir -p /var/cache/nginx /var/run/nginx /var/lib/nginx/logs \
12
- && chown -R user:user /var/cache/nginx /var/run/nginx /var/lib/nginx /var/log/nginx
13
 
14
- # Copy our custom Nginx configuration
15
  COPY nginx.conf /etc/nginx/nginx.conf
16
 
17
- # Set up the web directory
18
  WORKDIR /app
19
  COPY --chown=user:user . /app
20
 
21
- # Switch to the non-root user
22
  USER user
23
-
24
- # Hugging Face Spaces must run on port 7860
25
  EXPOSE 7860
26
 
27
- # Start both PHP-FPM and Nginx
28
  CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]
 
 
1
  FROM php:8.2-fpm-alpine
2
 
3
+ # Install Nginx and PHP Zip extension for unpacking uploaded sites
4
+ RUN apk add --no-cache nginx php82-pecl-zip php82-zip
5
 
 
6
  RUN adduser -D -u 1000 user
7
 
8
+ # Setup required directories and permissions
9
+ RUN mkdir -p /var/cache/nginx /var/run/nginx /var/lib/nginx/logs /tmp/sites \
10
+ && chown -R user:user /var/cache/nginx /var/run/nginx /var/lib/nginx /var/log/nginx /tmp/sites
11
 
 
12
  COPY nginx.conf /etc/nginx/nginx.conf
13
 
 
14
  WORKDIR /app
15
  COPY --chown=user:user . /app
16
 
 
17
  USER user
 
 
18
  EXPOSE 7860
19
 
 
20
  CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]