Spaces:
Sleeping
Sleeping
Commit
·
04fbc3e
1
Parent(s):
5c777b8
add: huggingface docker
Browse files- Dockerfile +9 -6
- Dockerfile.hf +0 -44
Dockerfile
CHANGED
@@ -16,14 +16,17 @@ COPY . .
|
|
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 \
|
@@ -34,8 +37,8 @@ RUN mkdir -p /var/cache/nginx/client_temp \
|
|
34 |
chown -R nginx:nginx /var/cache/nginx && \
|
35 |
chmod -R 755 /var/cache/nginx
|
36 |
|
37 |
-
# Expose port
|
38 |
-
EXPOSE
|
39 |
|
40 |
-
# Start nginx
|
41 |
CMD ["nginx", "-g", "daemon off;"]
|
|
|
16 |
# Build the application
|
17 |
RUN npm run build
|
18 |
|
19 |
+
# Stage 2: Production stage for Hugging Face Spaces
|
20 |
FROM nginx:alpine AS production
|
21 |
|
22 |
+
# Install wget for healthcheck
|
23 |
+
RUN apk add --no-cache wget
|
24 |
+
|
25 |
# Copy built application from builder stage
|
26 |
COPY --from=builder /app/dist /usr/share/nginx/html
|
27 |
|
28 |
+
# Copy custom nginx configuration for HF Spaces
|
29 |
+
COPY nginx.hf.conf /etc/nginx/nginx.conf
|
30 |
|
31 |
# Create nginx directories with proper permissions
|
32 |
RUN mkdir -p /var/cache/nginx/client_temp \
|
|
|
37 |
chown -R nginx:nginx /var/cache/nginx && \
|
38 |
chmod -R 755 /var/cache/nginx
|
39 |
|
40 |
+
# Expose port 7860 (required by Hugging Face Spaces)
|
41 |
+
EXPOSE 7860
|
42 |
|
43 |
+
# Start nginx on port 7860
|
44 |
CMD ["nginx", "-g", "daemon off;"]
|
Dockerfile.hf
DELETED
@@ -1,44 +0,0 @@
|
|
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 for Hugging Face Spaces
|
20 |
-
FROM nginx:alpine AS production
|
21 |
-
|
22 |
-
# Install wget for healthcheck
|
23 |
-
RUN apk add --no-cache wget
|
24 |
-
|
25 |
-
# Copy built application from builder stage
|
26 |
-
COPY --from=builder /app/dist /usr/share/nginx/html
|
27 |
-
|
28 |
-
# Copy custom nginx configuration for HF Spaces
|
29 |
-
COPY nginx.hf.conf /etc/nginx/nginx.conf
|
30 |
-
|
31 |
-
# Create nginx directories with proper permissions
|
32 |
-
RUN mkdir -p /var/cache/nginx/client_temp \
|
33 |
-
/var/cache/nginx/proxy_temp \
|
34 |
-
/var/cache/nginx/fastcgi_temp \
|
35 |
-
/var/cache/nginx/uwsgi_temp \
|
36 |
-
/var/cache/nginx/scgi_temp && \
|
37 |
-
chown -R nginx:nginx /var/cache/nginx && \
|
38 |
-
chmod -R 755 /var/cache/nginx
|
39 |
-
|
40 |
-
# Expose port 7860 (required by Hugging Face Spaces)
|
41 |
-
EXPOSE 7860
|
42 |
-
|
43 |
-
# Start nginx on port 7860
|
44 |
-
CMD ["nginx", "-g", "daemon off;"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|