-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathDockerfile.ubuntu
More file actions
61 lines (53 loc) · 2.44 KB
/
Dockerfile.ubuntu
File metadata and controls
61 lines (53 loc) · 2.44 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Dockerfile.ubuntu
# Start from the official Ubuntu-based node.js Docker image
FROM node:2.
ARG BUILD_DATE
LABEL build-date=$BUILD_DATE
LABEL maintainer="ZHAO Xudong <zxdong@gmail.com>"
LABEL description="This is Docker image for electerm-web"
LABEL url="https://github.com/electerm/electerm-web-docker"
LABEL vendor="electerm"
LABEL version="4.8.6"
# Additional standard Docker labels
LABEL org.opencontainers.image.title="electerm-web"
LABEL org.opencontainers.image.description="Docker image for electerm-web - SSH/SFTP/Telnet terminal client"
LABEL org.opencontainers.image.source="https://github.com/electerm/electerm-web-docker"
LABEL org.opencontainers.image.url="https://github.com/electerm/electerm-web-docker"
LABEL org.opencontainers.image.documentation="https://github.com/electerm/electerm-web-docker"
LABEL org.opencontainers.image.version="4.8.6"
LABEL org.opencontainers.image.created=$BUILD_DATE
LABEL org.opencontainers.image.authors="ZHAO Xudong <zxdong@gmail.com>"
LABEL org.opencontainers.image.vendor="electerm"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.ref.name="electerm-web"
LABEL org.opencontainers.image.base.name="node:22"
# Install the build tools necessary for node-gyp and additional tools
RUN apt-get update && apt-get install -y git python-is-python3 make build-essential g++ curl \
# Create the electerm user and group
&& groupadd -r electerm && useradd -r -g electerm -d /home/electerm -s /bin/bash electerm \
&& mkdir -p /home/electerm \
&& chown -R electerm:electerm /home/electerm && chmod 755 /home/electerm
WORKDIR /app
RUN chown -R electerm:electerm /app
# Switch to electerm user for building the application
USER electerm:electerm
# Clone and build the application
RUN git clone --depth 1 https://github.com/electerm/electerm-web.git
WORKDIR /app/electerm-web
RUN npm config set legacy-peer-deps true \
&& npm i \
&& npm run build \
&& cp .sample.env .env \
&& npm prune --production \
&& npm cache clean --force
# Switch back to root for cleanup
USER root
RUN apt-get remove -y git python-is-python3 make build-essential g++ && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app/electerm-web
# Set the environment variables
ENV NODE_ENV=production
# HOME points to data directory so logs/config are written to mounted volume
ENV HOME=/home/electerm/data
# No USER directive - allow --user flag to set runtime user
# This enables: docker run --user $(id -u):$(id -g) ...
CMD ["node", "./src/app/app.js"]