-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.ubuntu
45 lines (40 loc) · 1.49 KB
/
Dockerfile.ubuntu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Dockerfile.ubuntu
# Start from the official Ubuntu-based node.js Docker image
FROM node:18.20.4
ARG BUILD_DATE
LABEL build-date=$BUILD_DATE
LABEL maintainer="ZHAO Xudong <[email protected]>"
LABEL description="This is Docker image for electerm-web"
LABEL url="https://github.com/electerm/electerm-web-docker"
LABEL vendor="electerm"
LABEL version="2.50.21"
# Install the build tools necessary for node-gyp
RUN apt-get update && apt-get install -y git python-is-python3 make build-essential g++ \
# Create the electerm user and group
&& groupadd -r electerm && useradd -r -g electerm -d /home/electerm -s /bin/bash electerm \
&& mkdir /home/electerm \
# Set the ownership and permissions of the home directory
&& chown -R electerm:electerm /home/electerm && chmod 755 /home/electerm
USER electerm
# RUN chown -R electerm:electerm /home/electerm
WORKDIR /app
RUN chown -R electerm:electerm /app \
# Set the working directory in the Docker container
&& git clone --depth 1 https://github.com/electerm/electerm-web.git
WORKDIR /app/electerm-web
RUN npm uninstall @playwright/test chai playwright \
&& npm i \
&& npm run build \
&& cp .sample.env .env \
&& npm prune --production \
&& npm cache clean --force
# && npm config delete registry
USER root
RUN apt-get remove -y git python-is-python3 make build-essential g++
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
USER electerm
WORKDIR /app/electerm-web
# Set the environment variable
ENV NODE_ENV=production
# Run your application
CMD ["node", "./src/app/app.js"]