forked from negz/kuberos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use multi-staging dockerfile and scratch image
- Loading branch information
Showing
2 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,25 @@ | ||
FROM alpine:3.7 | ||
MAINTAINER Nic Cope <[email protected]> | ||
FROM node:9.8-alpine as node | ||
ADD frontend/ . | ||
RUN npm install && npm run build | ||
|
||
FROM golang:1.10-alpine as golang | ||
RUN apk --no-cache add git | ||
WORKDIR /go/src/github.com/negz/kuberos/ | ||
ENV CGO_ENABLED=0 | ||
|
||
ADD . . | ||
COPY --from=node dist/ dist/frontend | ||
COPY --from=node index.html dist/frontend/ | ||
|
||
RUN apk update && apk add ca-certificates | ||
RUN go get -u github.com/Masterminds/glide && \ | ||
go get -u github.com/rakyll/statik && \ | ||
glide install | ||
|
||
RUN cd statik && go generate && cd .. | ||
RUN go build -o /kuberos ./cmd/kuberos | ||
|
||
FROM alpine:3.7 as ca-certificates | ||
MAINTAINER Nic Cope <[email protected]> | ||
|
||
COPY "dist/kuberos" / | ||
RUN apk --no-cache add ca-certificates | ||
COPY --from=golang /kuberos / |