Spaces:
Sleeping
Sleeping
Commit
·
5111128
1
Parent(s):
04fbc3e
add: huggingface docker
Browse files- Dockerfile.prod +41 -0
Dockerfile.prod
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Stage 1: Build stage
|
2 |
+
FROM node:18-alpine AS builder
|
3 |
+
|
4 |
+
# Set working directory
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy package files
|
8 |
+
COPY package*.json ./
|
9 |
+
|
10 |
+
# Install dependencies
|
11 |
+
RUN npm ci --only=production=false
|
12 |
+
|
13 |
+
# Copy source code
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# Build the application
|
17 |
+
RUN npm run build
|
18 |
+
|
19 |
+
# Stage 2: Production stage
|
20 |
+
FROM nginx:alpine AS production
|
21 |
+
|
22 |
+
# Copy built application from builder stage
|
23 |
+
COPY --from=builder /app/dist /usr/share/nginx/html
|
24 |
+
|
25 |
+
# Copy custom nginx configuration
|
26 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
27 |
+
|
28 |
+
# Create nginx directories with proper permissions
|
29 |
+
RUN mkdir -p /var/cache/nginx/client_temp \
|
30 |
+
/var/cache/nginx/proxy_temp \
|
31 |
+
/var/cache/nginx/fastcgi_temp \
|
32 |
+
/var/cache/nginx/uwsgi_temp \
|
33 |
+
/var/cache/nginx/scgi_temp && \
|
34 |
+
chown -R nginx:nginx /var/cache/nginx && \
|
35 |
+
chmod -R 755 /var/cache/nginx
|
36 |
+
|
37 |
+
# Expose port 80
|
38 |
+
EXPOSE 80
|
39 |
+
|
40 |
+
# Start nginx
|
41 |
+
CMD ["nginx", "-g", "daemon off;"]
|