Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +23 -10
Dockerfile
CHANGED
@@ -1,16 +1,29 @@
|
|
1 |
FROM node:20
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
RUN npm install -g pnpm
|
4 |
-
# 克隆代码库
|
5 |
-
RUN git clone https://github.com/designcombo/react-video-editor.git
|
6 |
-
WORKDIR "react-video-editor"
|
7 |
-
# 设置权限
|
8 |
-
RUN chmod -R 777 /react-video-editor
|
9 |
-
# 使用 pnpm 安装依赖项并构建项目
|
10 |
-
RUN pnpm i
|
11 |
|
|
|
|
|
|
|
|
|
12 |
EXPOSE 3000
|
13 |
ENV PORT 3000
|
14 |
-
# 再次设置权限
|
15 |
|
16 |
-
|
|
|
|
1 |
FROM node:20
|
2 |
+
|
3 |
+
# Create a non-root user
|
4 |
+
RUN useradd -m appuser
|
5 |
+
|
6 |
+
# Set the working directory
|
7 |
+
WORKDIR /home/appuser/react-video-editor
|
8 |
+
|
9 |
+
# Clone the code repository
|
10 |
+
RUN git clone https://github.com/designcombo/react-video-editor.git .
|
11 |
+
|
12 |
+
# Change ownership of the working directory
|
13 |
+
RUN chown -R appuser:appuser /home/appuser/react-video-editor
|
14 |
+
|
15 |
+
# Switch to the non-root user
|
16 |
+
USER appuser
|
17 |
+
|
18 |
+
# Install pnpm
|
19 |
RUN npm install -g pnpm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
# Install dependencies
|
22 |
+
RUN pnpm install
|
23 |
+
|
24 |
+
# Expose the port
|
25 |
EXPOSE 3000
|
26 |
ENV PORT 3000
|
|
|
27 |
|
28 |
+
# Start the application
|
29 |
+
CMD ["pnpm", "dev"]
|