RaBU1234 commited on
Commit
d06e600
·
verified ·
1 Parent(s): 4e0b6cb

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +45 -0
Dockerfile ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ git \
8
+ curl \
9
+ wget \
10
+ python3 \
11
+ python3-pip \
12
+ nginx \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Install pnpm globally
16
+ RUN npm install -g pnpm
17
+
18
+ # Copy package files and install dependencies
19
+ COPY package.json server.js ./
20
+ RUN npm install
21
+
22
+ # Remove default nginx site
23
+ RUN rm -f /etc/nginx/sites-enabled/default
24
+ RUN rm -f /etc/nginx/sites-available/default
25
+
26
+ # Copy nginx configuration
27
+ COPY nginx.conf /etc/nginx/sites-available/sandbox
28
+ RUN ln -s /etc/nginx/sites-available/sandbox /etc/nginx/sites-enabled/sandbox
29
+
30
+ # Copy and make entrypoint executable
31
+ COPY entrypoint.sh /entrypoint.sh
32
+ RUN chmod +x /entrypoint.sh
33
+
34
+ # Create necessary directories
35
+ RUN mkdir -p /var/log/nginx /tmp/sandboxes
36
+
37
+ # Expose Hugging Face required port
38
+ EXPOSE 7860
39
+
40
+ # Health check
41
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
42
+ CMD curl -f http://localhost:7860/ || exit 1
43
+
44
+ # Run entrypoint script
45
+ CMD ["/entrypoint.sh"]