-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
44 lines (31 loc) · 1.34 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
FROM golang:1.11.1-alpine as builder
RUN apk add --update --no-cache git gcc musl-dev linux-headers make
ENV APP_NAME="pm-kyc-service"
# Set up the environment to use the workspace.
ENV APP_DIR=/go/src/github.com/gnosis/${APP_NAME}
RUN mkdir -p $APP_DIR
ENV GOPATH="/go"
# dep as dependency manager
RUN go get -u github.com/golang/dep/cmd/dep
# bee command line, for generating docs and compiling
RUN go get github.com/beego/bee
COPY Gopkg.toml Gopkg.lock $APP_DIR/
# Install dependencies
RUN cd ${APP_DIR} && dep ensure -v -vendor-only
# Easy fix to https://github.com/golang/dep/issues/1847
RUN go get github.com/ethereum/go-ethereum
RUN cp -r \
"${GOPATH}/src/github.com/ethereum/go-ethereum/crypto/secp256k1/libsecp256k1" \
"${APP_DIR}/vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/"
ADD . ${APP_DIR}
# Compile files
RUN cd ${APP_DIR} && $GOPATH/bin/bee generate docs && ONLY_COMPILE=true go run main.go && go build
# Pull Geth into a second stage deploy alpine container
FROM alpine:latest
RUN apk add --no-cache ca-certificates tini
COPY --from=builder /go/src/github.com/gnosis/pm-kyc-service/pm-kyc-service /usr/local/bin/
WORKDIR /root
COPY --from=builder /go/src/github.com/gnosis/pm-kyc-service/swagger ./swagger
COPY --from=builder /go/src/github.com/gnosis/pm-kyc-service/prod-conf ./conf
ENTRYPOINT ["/sbin/tini", "--"]
EXPOSE 8080