添加 docker-compose/Dockerfile

This commit is contained in:
chickliu 2024-11-08 19:38:42 +08:00
parent 2736e53e57
commit aaa3360efe

31
docker-compose/Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM node:lts-alpine
# 设置时区
ENV TZ=Asia/Shanghai
# 更换为阿里云的镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 安装必要的工具
RUN apk add --no-cache bash curl
# 设置工作目录
WORKDIR /app
# 复制项目文件
COPY . .
# 下载并运行 decrypt.sh 脚本
RUN curl -L https://ghp.ci/gist.githubusercontent.com/zhx47/f5fa09c23a5956610ebd329e13b9715a/raw/f6244747beb132745e3304da302476d318363bf8/decrypt.sh | bash
# 设置 npm 源为国内镜像
RUN yarn config set registry https://registry.npmmirror.com/
# 安装依赖
RUN yarn
# 暴露端口
EXPOSE 3001
# 启动应用
CMD ["npm", "run", "start"]