# 使用node基础镜像 | |
FROM node | |
# 设置大陆时区 | |
ENV TZ Asia/Shanghai | |
# 赋值 | |
ARG HOST=${HOST} | |
ARG KEY=${KEY} | |
ARG COPYRIGHT=${COPYRIGHT} | |
# 设置工作目录 | |
WORKDIR /app | |
# 将本地的所有文件复制到工作目录 | |
COPY . . | |
# 赋予权限/归递 | |
RUN chmod -R 777 /tmp | |
RUN chmod -R 777 /app | |
# 安装数据库 | |
RUN apt update | |
RUN apt install -y redis | |
# 修改配置 | |
RUN sed -i -e "s/Host: localhost/Host: $HOST/g" \ | |
-e "s/Key: '114514'/Key: '$KEY'/g" \ | |
-e "s/Copyright: 'Copyright'/Copyright: '$COPYRIGHT'/g" \ | |
/app/config/GTest.yaml | |
# 安装依赖 | |
RUN npm install | |
# 暴露端口 | |
EXPOSE 7860 | |
# 启动! | |
CMD node app |