fuliai commited on
Commit
cec9008
·
verified ·
1 Parent(s): 8762e02

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +2 -59
Dockerfile CHANGED
@@ -1,59 +1,3 @@
1
- # 使用官方的基于 Ubuntu 的 Node.js 18 镜像
2
- FROM node:20
3
-
4
- # 设置构建时的参数和标签信息
5
- ARG BUILD_DATE
6
- LABEL build-date=$BUILD_DATE
7
- LABEL maintainer="ZHAO Xudong <[email protected]>"
8
- LABEL description="This is Docker image for electerm-web"
9
- LABEL url="https://github.com/electerm/electerm-web-docker"
10
- LABEL vendor="electerm"
11
- LABEL version="2.39.109"
12
-
13
- # 安装构建工具,并创建 electerm 用户和组
14
- RUN apt-get update && \
15
- apt-get install -y --no-install-recommends git python-is-python3 make build-essential g++ && \
16
- groupadd -r electerm && \
17
- useradd -r -g electerm -d /home/electerm -s /bin/bash electerm && \
18
- mkdir -p /home/electerm && \
19
- chown -R electerm:electerm /home/electerm && \
20
- chmod 755 /home/electerm
21
-
22
- # 切换到 electerm 用户并设置工作目录
23
- USER electerm
24
- WORKDIR /app
25
-
26
- # 克隆 electerm-web 仓库,创建目录并设置权限
27
- RUN git clone --depth 1 https://github.com/electerm/electerm-web.git /app/electerm-web && \
28
- mkdir -p /app/electerm-web/data/electerm_session_logs && \
29
- chown -R electerm:electerm /app/electerm-web
30
-
31
- WORKDIR /app/electerm-web
32
-
33
- # 安装依赖并构建项目
34
- RUN npm uninstall @playwright/test chai playwright && \
35
- npm install && \
36
- npm run build && \
37
- cp .sample.env .env && \
38
- npm prune --production && \
39
- npm cache clean --force
40
-
41
- # 清理不必要的构建依赖
42
- USER root
43
- RUN apt-get remove -y git python-is-python3 make build-essential g++ && \
44
- apt-get autoremove -y && \
45
- apt-get clean && \
46
- rm -rf /var/lib/apt/lists/*
47
-
48
- # 切换回 electerm 用户并设置最终的工作目录
49
- USER electerm
50
- WORKDIR /app/electerm-web
51
-
52
- # 启动应用
53
- CMD ["node", "./src/app/app.js"]
54
-
55
- # Dockerfile.ubuntu
56
- # Start from the official Ubuntu-based node.js Docker image
57
  FROM node:18
58
  ARG BUILD_DATE
59
  LABEL build-date=$BUILD_DATE
@@ -69,9 +13,8 @@ RUN apt-get update && apt-get install -y git python-is-python3 make build-essent
69
  && groupadd -r electerm && useradd -r -g electerm -d /home/electerm -s /bin/bash electerm \
70
  && mkdir /home/electerm \
71
  # Set the ownership and permissions of the home directory
72
- && chown -R electerm:electerm /home/electerm && chmod 755 /home/electerm && \
73
- mkdir -p /app/electerm-web/data/electerm_session_logs && \
74
- chown -R electerm:electerm /app/electerm-web
75
  USER electerm
76
  # RUN chown -R electerm:electerm /home/electerm
77
  WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM node:18
2
  ARG BUILD_DATE
3
  LABEL build-date=$BUILD_DATE
 
13
  && groupadd -r electerm && useradd -r -g electerm -d /home/electerm -s /bin/bash electerm \
14
  && mkdir /home/electerm \
15
  # Set the ownership and permissions of the home directory
16
+ && chown -R electerm:electerm /home/electerm && chmod 755 /home/electerm
17
+
 
18
  USER electerm
19
  # RUN chown -R electerm:electerm /home/electerm
20
  WORKDIR /app