-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (33 loc) · 995 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# Build
#
FROM golang:1.12-alpine AS builder
ENV GO_DOMAIN="github.com" \
GO_GROUP="otaviof" \
GO_PROJECT="vault-handler"
ENV APP_DIR="${GOPATH}/src/${GO_DOMAIN}/${GO_GROUP}/${GO_PROJECT}"
RUN apk --update add git make
RUN go get -u github.com/golang/dep/cmd/dep
RUN mkdir -v -p ${APP_DIR}
WORKDIR ${APP_DIR}
COPY Makefile Gopkg.* ./
RUN make clean clean-vendor bootstrap
COPY . ./
RUN make
#
# Run
#
FROM golang:1.12-alpine
ENV GO_DOMAIN="github.com" \
GO_GROUP="otaviof" \
GO_PROJECT="vault-handler"
ENV APP_DIR="${GOPATH}/src/${GO_DOMAIN}/${GO_GROUP}/${GO_PROJECT}" \
USER_UID="1111" \
VAULT_HANDLER_OUTPUT_DIR="/var/lib/vault-handler"
RUN apk --update add bash
COPY --from=builder ${APP_DIR}/build/${GO_PROJECT} /usr/local/bin/${GO_PROJECT}
RUN adduser -h ${VAULT_HANDLER_OUTPUT_DIR} -D -u ${USER_UID} ${GO_PROJECT}
USER ${USER_UID}
VOLUME ${VAULT_HANDLER_OUTPUT_DIR}
WORKDIR ${VAULT_HANDLER_OUTPUT_DIR}
ENTRYPOINT [ "/usr/local/bin/vault-handler" ]