FROM nginx:alpine | |
# Copy all files to the NGINX html directory | |
COPY . /usr/share/nginx/html/ | |
# Set proper permissions | |
RUN chmod -R 755 /usr/share/nginx/html | |
# Create default.conf for nginx to listen on port 7860 (Hugging Face's default port) | |
RUN echo 'server { \ | |
listen 7860; \ | |
server_name _; \ | |
location / { \ | |
root /usr/share/nginx/html; \ | |
index index.html; \ | |
try_files $uri $uri/ /index.html; \ | |
} \ | |
}' > /etc/nginx/conf.d/default.conf | |
# Expose port 7860 for Hugging Face Spaces | |
EXPOSE 7860 | |
# Start NGINX | |
CMD ["nginx", "-g", "daemon off;"] | |