Spaces:
Build error
Build error
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;"] |