You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
riskshell/Dockerfile

43 lines
1.4 KiB

#使用alpine作为基础镜像
FROM node:current-alpine3.12
#拷贝公钥免密克隆仓库代码
COPY .ssh /root/.ssh
#拷贝到容器里的密钥需要修改权限才能正常使用
RUN chmod 400 /root/.ssh/id_rsa
RUN mkdir /app
#拷贝自动更新部署应用的命令
COPY shell/* /app/
#为命令建立软链接
RUN ln -s /app/* /usr/local/bin/ && chmod +x /app/*
#启用 openresty 仓库
COPY admin@openresty.com-5ea678a6.rsa.pub /etc/apk/keys/admin@openresty.com-5ea678a6.rsa.pub
RUN echo "http://openresty.org/package/alpine/v3.12/main" \
| tee -a /etc/apk/repositories
#使用阿里云镜像源安装库
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk update && apk add git openssh curl openresty tzdata
# 设置时区为上海
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
WORKDIR /usr/local/openresty/nginx
#备份openresty默认配置,拷贝自定义配置
RUN mv conf/nginx.conf conf/nginx.conf.bak
COPY conf/nginx.conf conf/nginx.conf
#添加openresty软链接
RUN ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/
#拷贝应用代码
WORKDIR /app
#git web钩子服务端
RUN git clone git@gogs.kirito.cool:panqihua/RiskCloudRun.git
WORKDIR /app/RiskCloudRun
#安装依赖
#使用淘宝镜像源
RUN yarn global add yrm && yrm use taobao
RUN yarn
#设置工作目录
WORKDIR /app
#运行初始化脚本
ENTRYPOINT ["initRisk"]