super-graph/Dockerfile

49 lines
1.0 KiB
Docker
Raw Normal View History

# stage: 1
FROM node:10 as react-build
WORKDIR /web
COPY web/ ./
RUN yarn
RUN yarn build
# stage: 2
2019-07-30 07:38:05 +02:00
FROM golang:1.13beta1-alpine as go-build
2019-03-27 05:14:07 +01:00
RUN apk update && \
2019-03-28 06:57:49 +01:00
apk add --no-cache git && \
2019-07-29 07:13:33 +02:00
apk add --no-cache upx=3.95-r2
2019-03-27 05:14:07 +01:00
RUN go get -u github.com/shanzi/wu && \
go install github.com/shanzi/wu && \
go get github.com/GeertJohan/go.rice/rice
2019-03-28 06:51:46 +01:00
WORKDIR /app
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-24 14:57:29 +01:00
ENV GO111MODULE=on
RUN go mod vendor
RUN go generate ./... && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o super-graph && \
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
# 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
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
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 .
2019-03-27 05:14:07 +01:00
2019-09-09 06:02:25 +02:00
RUN chmod +x /super-graph
2019-03-27 05:14:07 +01:00
USER nobody
EXPOSE 8080
2019-09-26 06:35:31 +02:00
CMD ./super-graph serv