2019-03-28 17:36:24 +01:00
|
|
|
# stage: 1
|
|
|
|
FROM node:10 as react-build
|
|
|
|
WORKDIR /web
|
|
|
|
COPY web/ ./
|
|
|
|
RUN yarn
|
|
|
|
RUN yarn build
|
|
|
|
|
|
|
|
# stage: 2
|
2020-03-03 09:15:47 +01:00
|
|
|
FROM golang:1.14-alpine as go-build
|
2019-03-27 05:14:07 +01:00
|
|
|
RUN apk update && \
|
2019-11-28 07:25:46 +01:00
|
|
|
apk add --no-cache make && \
|
2019-03-28 06:57:49 +01:00
|
|
|
apk add --no-cache git && \
|
2020-03-03 09:15:47 +01:00
|
|
|
apk add --no-cache jq && \
|
2020-03-03 15:14:14 +01:00
|
|
|
apk add --no-cache upx=3.96
|
2019-03-27 05:14:07 +01:00
|
|
|
|
2019-11-28 21:27:20 +01:00
|
|
|
RUN GO111MODULE=off go get -u github.com/rafaelsq/wtc
|
2019-03-28 03:01:02 +01:00
|
|
|
|
2020-03-03 09:15:47 +01:00
|
|
|
ARG SOPS_VERSION=3.5.0
|
|
|
|
ADD https://github.com/mozilla/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux /usr/local/bin/sops
|
|
|
|
RUN chmod 755 /usr/local/bin/sops
|
|
|
|
|
2019-03-28 06:51:46 +01:00
|
|
|
WORKDIR /app
|
2019-03-28 17:36:24 +01:00
|
|
|
COPY . /app
|
|
|
|
|
|
|
|
RUN mkdir -p /app/web/build
|
|
|
|
COPY --from=react-build /web/build/ ./web/build/
|
2019-03-28 06:51:46 +01:00
|
|
|
|
2019-03-28 03:01:02 +01:00
|
|
|
RUN go mod vendor
|
2019-11-28 07:25:46 +01:00
|
|
|
RUN make build
|
2020-03-03 15:14:14 +01:00
|
|
|
RUN echo "Compressing binary, will take a bit of time..." && \
|
|
|
|
upx --ultra-brute -qq super-graph && \
|
|
|
|
upx -t super-graph
|
2019-03-24 14:57:29 +01:00
|
|
|
|
2019-03-28 17:36:24 +01:00
|
|
|
# stage: 3
|
2019-03-24 14:57:29 +01:00
|
|
|
FROM alpine:latest
|
2019-09-09 06:02:25 +02:00
|
|
|
WORKDIR /
|
2019-03-28 05:37:39 +01:00
|
|
|
|
2019-03-28 03:01:02 +01:00
|
|
|
RUN apk add --no-cache tzdata
|
2019-09-09 06:02:25 +02:00
|
|
|
RUN mkdir -p /config
|
2019-03-27 05:14:07 +01:00
|
|
|
|
2019-03-28 17:36:24 +01:00
|
|
|
COPY --from=go-build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2019-09-09 06:02:25 +02:00
|
|
|
COPY --from=go-build /app/config/* /config/
|
|
|
|
COPY --from=go-build /app/super-graph .
|
2020-03-03 09:15:47 +01:00
|
|
|
COPY --from=go-build /app/scripts/start.sh .
|
|
|
|
COPY --from=go-build /usr/local/bin/sops .
|
2019-03-27 05:14:07 +01:00
|
|
|
|
2019-09-09 06:02:25 +02:00
|
|
|
RUN chmod +x /super-graph
|
2020-03-03 09:15:47 +01:00
|
|
|
RUN chmod +x /start.sh
|
|
|
|
|
2019-03-27 05:14:07 +01:00
|
|
|
USER nobody
|
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
2019-09-26 06:35:31 +02:00
|
|
|
CMD ./super-graph serv
|
2020-03-03 09:15:47 +01:00
|
|
|
ENTRYPOINT ["./start.sh"]
|