1 Star 0 Fork 341

大涛/gopub

forked from devops运维开发/gopub
关闭
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
linclc 提交于 2019-04-16 17:27 . node镜像编译优化
#docker 17.05+版本支持
#sudo docker build -t gopub .
#sudo docker run --name gopub -p 8192:8192 --restart always -d gopub:latest
FROM golang:1.12.4-alpine3.9 as golang
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add bash && \
rm -rf /var/cache/apk/* /tmp/*
ADD src/ /data/gopub/src/
ADD control /data/gopub/control
WORKDIR /data/gopub/
RUN ./control build
FROM node:11.14.0-alpine as node
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk update --no-cache && \
apk add --no-cache --virtual .gyp python make g++ && \
rm -rf /var/cache/apk/* /tmp/*
ADD ./ /data/gopub/
WORKDIR /data/gopub/vue-gopub
RUN npm install -g node-gyp --registry=https://registry.npm.taobao.org && \
npm install node-sass sass-loader --save-dev --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/dist --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ && \
npm install --registry=https://registry.npm.taobao.org && \
npm run build
FROM alpine:3.9.3
MAINTAINER Linc "13579443@qq.com"
ENV TZ='Asia/Shanghai'
RUN TERM=linux && export TERM
USER root
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add ca-certificates bash tzdata sudo curl wget openssh git && \
echo "Asia/Shanghai" > /etc/timezone && \
cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
rm -rf /var/cache/apk/* /tmp/* && \
mkdir -p /data/htdocs && \
mkdir -p /data/logs && \
ssh-keygen -q -N "" -f /root/.ssh/id_rsa && \
#输出的key需要加入发布目标机的 ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub
WORKDIR /data/gopub
ADD control /data/gopub/control
COPY --from=golang /data/gopub/src/gopub /data/gopub/src/gopub
COPY --from=golang /data/gopub/src/conf /data/gopub/src/conf
COPY --from=golang /data/gopub/src/logs /data/gopub/src/logs
COPY --from=golang /data/gopub/src/agent /data/gopub/src/agent
COPY --from=node /data/gopub/src/views /data/gopub/src/views
COPY --from=node /data/gopub/src/static /data/gopub/src/static
CMD ["./control","rundocker"]
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/datao119/gopub.git
git@gitee.com:datao119/gopub.git
datao119
gopub
gopub
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385