Update Dockerfile
Browse files- Dockerfile +48 -0
Dockerfile
CHANGED
@@ -52,3 +52,51 @@ WORKDIR /app/electerm-web
|
|
52 |
# 启动应用
|
53 |
CMD ["node", "./src/app/app.js"]
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
60 |
+
LABEL maintainer="ZHAO Xudong <[email protected]>"
|
61 |
+
LABEL description="This is Docker image for electerm-web"
|
62 |
+
LABEL url="https://github.com/electerm/electerm-web-docker"
|
63 |
+
LABEL vendor="electerm"
|
64 |
+
LABEL version="2.39.109"
|
65 |
+
|
66 |
+
# Install the build tools necessary for node-gyp
|
67 |
+
RUN apt-get update && apt-get install -y git python-is-python3 make build-essential g++ \
|
68 |
+
# Create the electerm user and group
|
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
|
78 |
+
RUN chown -R electerm:electerm /app \
|
79 |
+
# Set the working directory in the Docker container
|
80 |
+
&& git clone --depth 1 https://github.com/electerm/electerm-web.git
|
81 |
+
WORKDIR /app/electerm-web
|
82 |
+
RUN npm uninstall @playwright/test chai playwright \
|
83 |
+
&& npm i \
|
84 |
+
&& npm run build \
|
85 |
+
&& cp .sample.env .env \
|
86 |
+
&& npm prune --production \
|
87 |
+
&& npm cache clean --force
|
88 |
+
# && npm config delete registry
|
89 |
+
|
90 |
+
USER root
|
91 |
+
RUN apt-get remove -y git python-is-python3 make build-essential g++
|
92 |
+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
93 |
+
|
94 |
+
USER electerm
|
95 |
+
WORKDIR /app/electerm-web
|
96 |
+
|
97 |
+
# Set the environment variable
|
98 |
+
ENV NODE_ENV=production
|
99 |
+
|
100 |
+
# Run your application
|
101 |
+
CMD ["node", "./src/app/app.js"]
|
102 |
+
|