-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding docker automation * updated changelog * bump travis go version
- Loading branch information
Showing
8 changed files
with
493 additions
and
61 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
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,26 +1,48 @@ | ||
FROM golang:alpine as builder | ||
FROM docker.io/library/golang:1.14-alpine as builder | ||
|
||
MAINTAINER Jack Murdock <[email protected]> | ||
|
||
WORKDIR /go/src/github.com/xmidt-org/caduceus | ||
ARG VERSION=undefined | ||
ARG GITCOMMIT=undefined | ||
ARG BUILDTIME=undefined | ||
|
||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash git openssh | ||
ARG VERSION=unknown | ||
ARG GITCOMMIT=unknown | ||
ARG BUILDTIME=unknown | ||
|
||
ADD https://github.com/geofffranks/spruce/releases/download/v1.25.2/spruce-linux-amd64 /usr/local/bin/spruce | ||
RUN chmod +x /usr/local/bin/spruce | ||
|
||
RUN apk add --no-cache --no-progress \ | ||
ca-certificates \ | ||
make \ | ||
git \ | ||
openssh \ | ||
gcc \ | ||
libc-dev \ | ||
upx | ||
|
||
COPY . . | ||
RUN GO111MODULE=on go build -ldflags "-X 'main.BuildTime=${BUILDTIME}' -X main.GitCommit=${GITCOMMIT} -X main.Version=${VERSION}" -o caduceus_linux_amd64 | ||
RUN make build | ||
|
||
FROM alpine:latest | ||
|
||
COPY --from=builder /etc/passwd /etc/passwd | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /go/src/github.com/xmidt-org/caduceus/caduceus.yaml /caduceus.yaml | ||
COPY --from=builder /go/src/github.com/xmidt-org/caduceus/caduceus /caduceus | ||
COPY --from=builder /go/src/github.com/xmidt-org/caduceus/deploy/Dockerfile /go/src/github.com/xmidt-org/caduceus/NOTICE /go/src/github.com/xmidt-org/caduceus/LICENSE /go/src/github.com/xmidt-org/caduceus/CHANGELOG.md / | ||
COPY --from=builder /go/src/github.com/xmidt-org/caduceus/deploy/packaging/entrypoint.sh /entrypoint.sh | ||
COPY --from=builder /go/src/github.com/xmidt-org/caduceus/deploy/packaging/caduceus_spruce.yaml /tmp/caduceus_spruce.yaml | ||
COPY --from=builder /usr/local/bin/spruce /spruce | ||
|
||
RUN mkdir /etc/caduceus/ && touch /etc/caduceus/caduceus.yaml && chmod 666 /etc/caduceus/caduceus.yaml | ||
|
||
FROM alpine | ||
USER nobody | ||
|
||
RUN apk --no-cache add ca-certificates | ||
RUN mkdir -p /etc/caduceus | ||
VOLUME /etc/caduceus | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
EXPOSE 8080 | ||
EXPOSE 6000 | ||
EXPOSE 6001 | ||
EXPOSE 6002 | ||
EXPOSE 6003 | ||
|
||
COPY --from=builder /go/src/github.com/xmidt-org/caduceus/caduceus_linux_amd64 / | ||
COPY caduceus.yaml / | ||
COPY deploy/Dockerfile NOTICE LICENSE CHANGELOG.md / | ||
ENTRYPOINT ["/caduceus_linux_amd64"] | ||
CMD ["/caduceus"] |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env sh | ||
|
||
# upload docker as $TRAVIS_TAG or latest | ||
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
|
||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1` | tail -1 | sed 's/v\(.*\)/\1/') | ||
VERSION_TAG=$(echo "$TRAVIS_TAG" | sed 's/v\(.*\)/\1/') | ||
|
||
docker build --build-arg VERSION="$VERSION_TAG" --build-arg GITCOMMIT="`git rev-parse --short HEAD`" --build-arg BUILDTIME="`date -u '+%Y-%m-%d %H:%M:%S'`" -f ./deploy/Dockerfile -t xmidt/caduceus:$VERSION_TAG . | ||
|
||
docker push xmidt/caduceus:$VERSION_TAG | ||
|
||
if [[ "$VERSION_TAG" == "$LATEST_TAG" ]]; then | ||
docker tag xmidt/caduceus:$VERSION_TAG xmidt/caduceus:latest | ||
docker push xmidt/caduceus:latest | ||
fi |
Oops, something went wrong.