-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (62 loc) · 2.48 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#docker 17.05+版本支持
#sudo docker build -t akgo .
#sudo docker run --name akgo -p 8192:8192 --restart always -d akgo:latest
FROM golang:1.15.15-alpine3.14 as golang
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add bash gcc musl-dev && \
rm -rf /var/cache/apk/* /tmp/*
ADD src/ /data/akgo/src/
ADD control /data/akgo/control
WORKDIR /data/akgo/
RUN ./control build
# FROM akoss-vue:v1.0.1 as node
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 && \
rm -rf /var/cache/apk/* /tmp/*
ADD ./ /data/akgo/
WORKDIR /data/akgo/vue-akgo
RUN npm config set strict-ssl false && \
npm config set unsafe_perm true && \
npm install node-gyp && \
npm install vue-wechat-title && \
npm install file-saver xlsx && \
npm install node-sass sass-loader --unsafe-perm && \
npm install --unsafe-perm && \
npm install vuex-persistedstate --save
RUN npm run build
FROM alpine:3.9.3
ENV TZ='Asia/Shanghai'
RUN TERM=linux && export TERM
USER root
COPY src/file /data/akgo/src/file
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add ca-certificates bash vim tzdata sudo curl wget openssh docker mariadb-client chromium
RUN 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 && \
mkdir -p /data/akgo/src/logs && \
# 安装早准备好的中文字体
cp -r -f /data/akgo/src/file/chinese /usr/share/fonts && \
# 使用file目录下早准备好的密钥
mkdir -p ~/.ssh && \
cp /data/akgo/src/file/id_rsa ~/.ssh/id_rsa && \
cp /data/akgo/src/file/id_rsa.pub ~/.ssh/id_rsa.pub && \
chmod 700 ~/.ssh && \
chmod 600 ~/.ssh/id_rsa && \
chmod 600 ~/.ssh/id_rsa.pub && \
#输出的key需要加入发布目标机的 ~/.ssh/authorized_keys
# ssh-keygen -q -N "" -f /root/.ssh/id_rsa && \
cat ~/.ssh/id_rsa.pub
WORKDIR /data/akgo
ADD control /data/akgo/control
COPY --from=golang /data/akgo/src/akgo /data/akgo/src/akgo
COPY --from=golang /data/akgo/src/conf /data/akgo/src/conf
COPY --from=node /data/akgo/src/views /data/akgo/src/views
COPY --from=node /data/akgo/src/static /data/akgo/src/static
CMD ["./control","rundocker"]