Update Dockerfile
Browse files- Dockerfile +17 -8
Dockerfile
CHANGED
|
@@ -1,23 +1,32 @@
|
|
| 1 |
FROM node:lts-alpine
|
| 2 |
|
| 3 |
-
# Install
|
| 4 |
-
RUN apk add --no-cache git bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
# Set working directory
|
| 7 |
-
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Clone the repo
|
| 10 |
RUN git clone --depth=1 --branch stable https://github.com/stackblitz-labs/bolt.diy.git .
|
| 11 |
|
| 12 |
-
|
| 13 |
# Install pnpm globally
|
| 14 |
RUN npm install -g pnpm
|
| 15 |
|
| 16 |
-
# Install dependencies
|
| 17 |
RUN pnpm install
|
| 18 |
|
| 19 |
-
# Expose port
|
| 20 |
EXPOSE 7860
|
| 21 |
|
| 22 |
-
# Start the
|
| 23 |
CMD ["pnpm", "run", "dev", "-p", "7860"]
|
|
|
|
| 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"]
|