1- FROM golang:1.10.3
2- COPY . /go/src/github.com/grafeas/grafeas/
3- WORKDIR /go/src/github.com/grafeas/grafeas/samples/server/go-server/api/server/main
4- RUN CGO_ENABLED=0 go build -o grafeas-server .
1+ ARG GRAFEAS_VERSION=0.1.0
2+ FROM us.gcr.io/grafeas/grafeas-server:${GRAFEAS_VERSION} as grafeas-official
3+
4+ FROM alpine:latest as confd
5+ ARG CONFD_VERSION=0.15.0
6+ ADD https://github.com/kelseyhightower/confd/releases/download/v${CONFD_VERSION}/confd-${CONFD_VERSION}-linux-amd64 /usr/local/bin/confd
7+ RUN chmod +x /usr/local/bin/confd
58
69FROM alpine:latest
7- WORKDIR /
8- ADD https://github.com/kelseyhightower/confd/releases/download/v0.15.0/confd-0.15.0-linux-amd64 /usr/local/bin/confd
9- COPY build-files /tmp
10+ WORKDIR /grafeas
11+ RUN USER=grafeas && \
12+ UID=1234 && \
13+ GID=5678 && \
14+ addgroup -g "$GID" -S "$USER" && \
15+ adduser --disabled-password \
16+ -u "$UID" -S "$USER" -G "$USER" && \
17+ chown -R grafeas:grafeas /grafeas
18+ COPY --chown=grafeas:grafeas --from=confd /usr/local/bin/confd /usr/local/bin/confd
19+ COPY --chown=grafeas:grafeas --from=grafeas-official /grafeas-server .
20+ COPY --chown=grafeas:grafeas build-files /tmp
1021RUN chmod +x /usr/local/bin/confd && \
1122 mv /tmp/confd /etc && \
12- mv /tmp/entrypoint.sh /entrypoint.sh && \
13- chmod +x /entrypoint.sh
14- COPY --from=0 /go/src/github.com/ grafeas/grafeas/samples/server/go-server/api/server/main/grafeas-server /grafeas-server
23+ mv /tmp/entrypoint.sh /grafeas/ entrypoint.sh && \
24+ chmod +x /grafeas/ entrypoint.sh
25+ USER grafeas
1526EXPOSE 8080
16- ENTRYPOINT ["/entrypoint.sh" ]
17- CMD ["-config" , "config.yaml" ]
27+ ENTRYPOINT ["/grafeas/ entrypoint.sh" ]
28+ CMD ["-config" , "config.yaml" ]
0 commit comments