-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
34 lines (24 loc) · 887 Bytes
/
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
# golang:alpine is the alpine image with the go tools added.. manually add git
FROM golang:alpine as builder
ENV GO111MODULE=on
# install gcc for compilation
RUN apk add --update gcc musl-dev
# Set an env var that matches github repo name
# ENV CGO_ENABLED=0
ENV SRC_DIR=${HOME}/go/src/github.com/anothrnick/json-tree-service/
# Add the source code:
ADD . $SRC_DIR
# Build it:
# NOTE - dependencies will need to be in the vendor directory before building this image
RUN cd $SRC_DIR;\
apk add --no-cache git;\
go build -o api;
ENTRYPOINT ["/go/src/github.com/anothrnick/json-tree-service/api"]
# alpine production environment
# copy binary for smallest image size
FROM alpine:3.7
RUN apk add --no-cache ca-certificates
ENV GIN_MODE=release
COPY ./ui/build /ui/build
COPY --from=builder /go/src/github.com/anothrnick/json-tree-service/api /bin/api
ENTRYPOINT ["/bin/api"]