mfoud444 commited on
Commit
0f3cbaf
·
verified ·
1 Parent(s): b93b980

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -15
Dockerfile CHANGED
@@ -1,32 +1,31 @@
1
  FROM node:lts-alpine
2
 
3
- # Install dependencies
4
- RUN apk add --no-cache git bash shadow
5
 
6
- # Create user "user" with UID 1000
7
- RUN useradd -m -u 1000 user
8
 
9
- # Set environment variables
10
- ENV HOME=/home/user \
11
- PATH=/home/user/.local/bin:$PATH
12
 
13
- # Set working directory before any file operation
14
- WORKDIR $HOME/app
15
 
16
- # Change to non-root user
17
- USER user
18
 
19
- # Clone the repo
20
  RUN git clone --depth=1 --branch stable https://github.com/stackblitz-labs/bolt.diy.git .
21
 
22
  # Install pnpm globally
23
  RUN npm install -g pnpm
24
 
25
- # Install project dependencies
26
  RUN pnpm install
27
 
28
- # Expose port for Hugging Face Spaces
29
  EXPOSE 7860
30
 
31
- # Start the dev server
32
  CMD ["pnpm", "run", "dev", "-p", "7860"]
 
1
  FROM node:lts-alpine
2
 
3
+ # Install git and bash
4
+ RUN apk add --no-cache git bash
5
 
6
+ # Create a non-root user and group
7
+ RUN addgroup -S appgroup && adduser -S appuser -G appgroup
8
 
9
+ # Set working directory
10
+ WORKDIR /app
 
11
 
12
+ # Change ownership of the working directory
13
+ RUN chown -R appuser:appgroup /app
14
 
15
+ # Switch to the non-root user
16
+ USER appuser
17
 
18
+ # Clone the repository
19
  RUN git clone --depth=1 --branch stable https://github.com/stackblitz-labs/bolt.diy.git .
20
 
21
  # Install pnpm globally
22
  RUN npm install -g pnpm
23
 
24
+ # Install dependencies
25
  RUN pnpm install
26
 
27
+ # Expose port 7860
28
  EXPOSE 7860
29
 
30
+ # Start the development server
31
  CMD ["pnpm", "run", "dev", "-p", "7860"]