-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.api
51 lines (38 loc) · 869 Bytes
/
Dockerfile.api
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
45
46
47
48
49
50
51
ARG BINARY
ARG GOVERSION
ARG VERSION
FROM golang:${GOVERSION}-alpine AS builder
ARG BINARY
ARG PACKAGE
ARG VERSION
WORKDIR /go/src/$PACKAGE
RUN set -ex ; \
apk update ; \
apk add \
ca-certificates \
curl \
git \
make \
tree \
;
ADD https://raw.githubusercontent.com/golang/dep/master/install.sh /install-dep.sh
RUN set -ex ; \
chmod +x /install-dep.sh ; \
/install-dep.sh ; \
rm /install-dep.sh
COPY cmd cmd
COPY Gopkg.lock Gopkg.lock
COPY Gopkg.toml Gopkg.toml
COPY main.go main.go
COPY Makefile Makefile
COPY pkg pkg
RUN set -ex ; \
dep ensure ; \
tree ; \
make install
FROM scratch
ARG BINARY
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/bin/$BINARY /usr/local/bin/docker-entrypoint
EXPOSE 8080
ENTRYPOINT ["docker-entrypoint"]