File size: 665 Bytes
cf9c856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM nginx:alpine

# Install Python for health check
RUN apk add --no-cache python3

# Copy all project files to the nginx html directory
COPY . /usr/share/nginx/html

# Remove the .git directory from the final image
RUN rm -rf /usr/share/nginx/html/.git

# Configure nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Make health check script executable
RUN chmod +x /usr/share/nginx/html/healthcheck.py

# Expose port 7860 (default for Hugging Face Spaces)
EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
  CMD python3 /usr/share/nginx/html/healthcheck.py

# Start nginx
CMD ["nginx", "-g", "daemon off;"]