File size: 1,825 Bytes
0bb00fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
66
FROM node:20-alpine3.21
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.60.56"

WORKDIR /app

RUN apk add --no-cache python3 py3-pip

RUN addgroup -S electerm && \
    adduser -S -G electerm -h /home/electerm -s /bin/sh electerm && \
    mkdir -p /home/electerm /app && \
    chown -R electerm:electerm /home/electerm /app && \
    chmod 755 /home/electerm

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --no-cache-dir huggingface_hub

RUN apk update && apk add --no-cache \
    python3 \
    git \
    make \
    g++ \
    build-base && \
    cd /app && \
    git clone --depth 1 https://github.com/electerm/electerm-web.git && \
    cd electerm-web && \
    npm un @playwright/test chai playwright && \
    npm i ipv6 && \
    npm i && \
    npm audit fix --force && \
    npm run build && \
    cp .sample.env .env && \
    sed -i 's/HOST=.*/HOST=0.0.0.0/' .env && \
    sed -i 's/ENABLE_AUTH=.*/ENABLE_AUTH=1/' .env && \
    npm prune --production && \
    npm cache clean --force && \
    apk del build-base make g++ python3 git && \
    rm -rf /var/cache/apk/* && \
    mkdir -p /app/electerm-web/data/electerm_session_logs && \
    chown -R electerm:electerm /app/electerm-web && \
    chmod -R 777 /app/electerm-web/data

COPY sync_data.sh /
RUN chmod +x /sync_data.sh && \
    chown electerm:electerm /sync_data.sh

USER electerm
WORKDIR /app/electerm-web

ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV ENABLE_AUTH=1
ENV SERVER_SECRET=your-secret-key
ENV SERVER_PASS=your-password

EXPOSE 5577

# Run your application with sync
CMD ["/sync_data.sh"]