forked from Qihoo360/wayne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (28 loc) · 1.3 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
# requiring Docker 17.05 or higher on the daemon and client
# see https://docs.docker.com/develop/develop-images/multistage-build/
# BUILD COMMAND :
# docker --build-arg RELEASE_VERSION=v1.0.0 -t infra/wayne:v1.0.0 .
# build ui
FROM 360cloud/wayne-ui-builder:v1.0.0 as frontend
ARG RAVEN_DSN
COPY src/frontend /workspace
RUN sed -i "s~__ravenDsn__~${RAVEN_DSN}~g" /workspace/src/environments/environment.prod.ts
RUN cd /workspace && \
npm config set registry https://registry.npm.taobao.org && \
npm install && \
npm run build
# build server
FROM 360cloud/wayne-server-builder:v1.0.0 as backend
COPY src/vendor /go/src/github.com/Qihoo360/wayne/src/vendor
COPY src/backend /go/src/github.com/Qihoo360/wayne/src/backend
RUN rm -rf /go/src/github.com/Qihoo360/wayne/src/backend/static
COPY --from=frontend /workspace/dist/ /go/src/github.com/Qihoo360/wayne/src/backend/static/
COPY --from=frontend /workspace/dist/index.html /go/src/github.com/Qihoo360/wayne/src/backend/views/
RUN cd /go/src/github.com/Qihoo360/wayne/src/backend && bee generate docs && bee pack -o /_build
# build release image
FROM centos:7
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY --from=backend /_build/backend.tar.gz /opt/wayne/
WORKDIR /opt/wayne/
RUN tar -xzvf backend.tar.gz
CMD ["./backend"]