Spaces:
Sleeping
Sleeping
Download Dockerfile.frontend from edichat/edi.chat.test: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/edichat/edi.chat.test/resolve/main/Dockerfile.frontend
- Command line
-
hf download hf://spaces/edichat/edi.chat.test/Dockerfile.frontend
-
curl -L -o Dockerfile.frontend https://huggingface.co/spaces/edichat/edi.chat.test/resolve/main/Dockerfile.frontend
1.23 kB
| # Frontend Dockerfile | |
| FROM node:18-alpine AS builder | |
| # Create app directory | |
| WORKDIR /app | |
| # Copy package files | |
| COPY frontend/package*.json ./ | |
| # Install dependencies | |
| RUN npm ci && npm cache clean --force | |
| # Copy source code | |
| COPY frontend/ . | |
| # Build the application | |
| RUN npm run build | |
| # Production stage | |
| FROM nginx:alpine AS production | |
| # Copy built app to nginx | |
| COPY --from=builder /app/build /usr/share/nginx/html | |
| # Copy nginx configuration | |
| COPY nginx.conf /etc/nginx/nginx.conf | |
| # Create non-root user for nginx | |
| RUN addgroup -g 1001 -S nginx-user && \ | |
| adduser -S nginx-user -u 1001 -G nginx-user | |
| # Set permissions | |
| RUN chown -R nginx-user:nginx-user /usr/share/nginx/html && \ | |
| chown -R nginx-user:nginx-user /var/cache/nginx && \ | |
| chown -R nginx-user:nginx-user /var/log/nginx && \ | |
| chown -R nginx-user:nginx-user /etc/nginx/conf.d | |
| # Update nginx config for non-root user | |
| RUN touch /var/run/nginx.pid && \ | |
| chown -R nginx-user:nginx-user /var/run/nginx.pid | |
| # Switch to non-root user | |
| USER nginx-user | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost/ || exit 1 | |
| # Expose port | |
| EXPOSE 80 | |
| # Start nginx | |
| CMD ["nginx", "-g", "daemon off;"] |