ai / Dockerfile
fuliai's picture
Update Dockerfile
1e85165 verified
FROM node:18
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.39.109"
# 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 && \
mkdir -p /app/electerm-web/data/electerm_session_logs && \
chown -R electerm:electerm /app/electerm-web
WORKDIR /app/electerm-web
RUN npm uninstall @playwright/test chai playwright \
&& npm i \
&& npm run build \
&& cp .sample.env .env \
&& sed -i 's/HOST=127.0.0.1/HOST=0.0.0.0/' .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"]