Reaperxxxx commited on
Commit
340c655
·
verified ·
1 Parent(s): c549ed1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -4
Dockerfile CHANGED
@@ -1,15 +1,19 @@
 
1
  FROM node:18-alpine
2
 
3
- # Create app directory
4
  WORKDIR /app
5
 
6
- # Copy application files
 
 
 
7
  COPY . .
8
 
9
  # Install dependencies
10
  RUN yarn install
11
 
12
- # Create and set permissions for users.json and users directory
13
  RUN touch users.json && \
14
  chmod 666 users.json && \
15
  mkdir -p users && \
@@ -18,8 +22,19 @@ RUN touch users.json && \
18
  # Ensure start.sh is executable
19
  RUN chmod +x start.sh
20
 
21
- # Expose port
 
 
 
 
22
  EXPOSE 7860
23
 
 
 
 
 
 
 
 
24
  # Run start script
25
  CMD ["sh", "./start.sh"]
 
1
+ # Base Node.js image
2
  FROM node:18-alpine
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install necessary tools (git, bash, etc.)
8
+ RUN apk add --no-cache git bash
9
+
10
+ # Copy application files to container
11
  COPY . .
12
 
13
  # Install dependencies
14
  RUN yarn install
15
 
16
+ # Set permissions for users.json and users directory
17
  RUN touch users.json && \
18
  chmod 666 users.json && \
19
  mkdir -p users && \
 
22
  # Ensure start.sh is executable
23
  RUN chmod +x start.sh
24
 
25
+ # Create a non-root user and switch to it
26
+ RUN adduser -D appuser
27
+ USER appuser
28
+
29
+ # Expose application port
30
  EXPOSE 7860
31
 
32
+ # Set default environment variables
33
+ ENV NODE_ENV=production
34
+ ENV PORT=7860
35
+
36
+ # Healthcheck to ensure app is running
37
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s CMD curl -f http://localhost:7860 || exit 1
38
+
39
  # Run start script
40
  CMD ["sh", "./start.sh"]