2019-03-28 12:36:24 -04:00
|
|
|
# stage: 1
|
|
|
|
FROM node:10 as react-build
|
|
|
|
WORKDIR /web
|
|
|
|
COPY web/ ./
|
|
|
|
RUN yarn
|
|
|
|
RUN yarn build
|
|
|
|
|
|
|
|
# stage: 2
|
2019-11-28 01:25:46 -05:00
|
|
|
FROM golang:1.13.4-alpine as go-build
|
2019-03-27 00:14:07 -04:00
|
|
|
RUN apk update && \
|
2019-11-28 01:25:46 -05:00
|
|
|
apk add --no-cache make && \
|
2019-03-28 01:57:49 -04:00
|
|
|
apk add --no-cache git && \
|
2019-07-29 01:13:33 -04:00
|
|
|
apk add --no-cache upx=3.95-r2
|
2019-03-27 00:14:07 -04:00
|
|
|
|
2019-11-28 15:27:20 -05:00
|
|
|
RUN GO111MODULE=off go get -u github.com/rafaelsq/wtc
|
2019-03-27 22:01:02 -04:00
|
|
|
|
2019-03-28 01:51:46 -04:00
|
|
|
WORKDIR /app
|
2019-03-28 12:36:24 -04:00
|
|
|
COPY . /app
|
|
|
|
|
|
|
|
RUN mkdir -p /app/web/build
|
|
|
|
COPY --from=react-build /web/build/ ./web/build/
|
2019-03-28 01:51:46 -04:00
|
|
|
|
2019-03-27 22:01:02 -04:00
|
|
|
RUN go mod vendor
|
2019-11-28 01:25:46 -05:00
|
|
|
RUN make build
|
|
|
|
RUN echo "Compressing binary, will take a bit of time..." && \
|
2019-09-27 02:30:07 -04:00
|
|
|
upx --ultra-brute -qq super-graph && \
|
|
|
|
upx -t super-graph
|
2019-03-24 09:57:29 -04:00
|
|
|
|
2019-03-28 12:36:24 -04:00
|
|
|
# stage: 3
|
2019-03-24 09:57:29 -04:00
|
|
|
FROM alpine:latest
|
2019-09-09 00:02:25 -04:00
|
|
|
WORKDIR /
|
2019-03-28 00:37:39 -04:00
|
|
|
|
2019-03-27 22:01:02 -04:00
|
|
|
RUN apk add --no-cache tzdata
|
2019-09-09 00:02:25 -04:00
|
|
|
RUN mkdir -p /config
|
2019-03-27 00:14:07 -04:00
|
|
|
|
2019-03-28 12:36:24 -04:00
|
|
|
COPY --from=go-build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2019-09-09 00:02:25 -04:00
|
|
|
COPY --from=go-build /app/config/* /config/
|
|
|
|
COPY --from=go-build /app/super-graph .
|
2019-03-27 00:14:07 -04:00
|
|
|
|
2019-09-09 00:02:25 -04:00
|
|
|
RUN chmod +x /super-graph
|
2019-03-27 00:14:07 -04:00
|
|
|
USER nobody
|
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
2019-09-26 00:35:31 -04:00
|
|
|
CMD ./super-graph serv
|