forked from BuoyantIO/emojivoto
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
73 lines (65 loc) · 3.44 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
65
66
67
68
69
70
71
72
73
FROM alpine/git:latest AS pull
COPY . /emojivoto
FROM ghcr.io/edgelesssys/ego-deploy:v1.5.3 AS emoji_base
RUN apt-get update && \
apt-get install -y --no-install-recommends curl dnsutils iptables jq nghttp2 && \
apt clean && \
apt autoclean
COPY ./start.sh /start.sh
FROM ghcr.io/edgelesssys/ego-dev:v1.5.3 AS emoji_build
WORKDIR /node
RUN curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && \
bash nodesource_setup.sh
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update && \
apt install -y yarn nodejs wget tar unzip
ARG GEN_GO_VER=1.28.1
ARG GEN_GO_GRPC_VER=1.2.0
ARG PB_VER=21.8
RUN wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PB_VER}/protoc-${PB_VER}-linux-x86_64.zip && \
unzip protoc-${PB_VER}-linux-x86_64.zip -d /root/.local && \
cp /root/.local/bin/protoc /usr/local/bin/protoc
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GEN_GO_VER} && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${GEN_GO_GRPC_VER}
ENV PATH="$PATH:/root/.local/bin:/root/go/bin"
COPY --from=pull /emojivoto /emojivoto
WORKDIR /emojivoto
RUN --mount=type=secret,id=signingkey,dst=/emojivoto/emojivoto-web/private.pem,required=true \
--mount=type=secret,id=signingkey,dst=/emojivoto/emojivoto-emoji-svc/private.pem,required=true \
--mount=type=secret,id=signingkey,dst=/emojivoto/emojivoto-voting-svc/private.pem,required=true \
ego env make build
FROM ghcr.io/edgelesssys/ego-dev:v1.5.3 AS patch_build
RUN apt update && apt install -y wget tar unzip
ARG GEN_GO_VER=1.28.1
ARG GEN_GO_GRPC_VER=1.2.0
ARG PB_VER=21.8
RUN wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PB_VER}/protoc-${PB_VER}-linux-x86_64.zip && \
unzip protoc-${PB_VER}-linux-x86_64.zip -d /root/.local && \
cp /root/.local/bin/protoc /usr/local/bin/protoc
ENV PATH="$PATH:/root/.local/bin:/root/go/bin"
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GEN_GO_VER} && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${GEN_GO_GRPC_VER}
COPY --from=pull /emojivoto /emojivoto
WORKDIR /emojivoto
RUN --mount=type=secret,id=signingkey,dst=/emojivoto/emojivoto-voting-svc/private.pem,required=true \
ego env make patch
FROM emoji_base AS release_emoji_svc
LABEL description="/emojivoto-emoji-svc"
COPY --from=emoji_build /emojivoto/emojivoto-emoji-svc/target/emojivoto-emoji-svc /emojivoto-emoji-svc
ENTRYPOINT ["/start.sh", "/emojivoto-emoji-svc"]
FROM emoji_base AS release_voting_svc
LABEL description="emojivoto-voting-svc"
COPY --from=emoji_build /emojivoto/emojivoto-voting-svc/target/emojivoto-voting-svc /emojivoto-voting-svc
ENTRYPOINT ["/start.sh", "/emojivoto-voting-svc"]
FROM emoji_base AS release_voting_update
LABEL description="emojivoto-voting-update"
COPY --from=patch_build /emojivoto/emojivoto-voting-svc/target/emojivoto-voting-svc /emojivoto-voting-svc
ENTRYPOINT ["/start.sh", "/emojivoto-voting-svc"]
FROM emoji_base AS release_web
LABEL description="emojivoto-web"
COPY --from=emoji_build /emojivoto/emojivoto-web/target/emojivoto-web /emojivoto-web
COPY --from=emoji_build /emojivoto/emojivoto-web/target/web /web
COPY --from=emoji_build /emojivoto/emojivoto-web/target/dist /dist
COPY --from=emoji_build /emojivoto/emojivoto-web/target/emojivoto-vote-bot /emojivoto-vote-bot
ENTRYPOINT ["/start.sh", "/emojivoto-web"]