-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update docker automation #152
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
750b368
bump go to v1.14
kcajmagic bea8097
switch docker base image to scratch
kcajmagic 6d4948c
remove go-mod-vendor
kcajmagic 95d5a61
bump builder image to 1.14
kcajmagic c0bf2f3
adding docker deploy step
kcajmagic 66de1b2
update changelog
kcajmagic 31ac5e8
only deploy docker if branch is master
kcajmagic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,28 +1,39 @@ | ||
FROM golang:alpine as builder | ||
FROM docker.io/library/golang:1.14-alpine as builder | ||
|
||
MAINTAINER Jack Murdock <jack_murdock@comcast.com> | ||
|
||
WORKDIR /go/src/github.com/xmidt-org/tr1d1um | ||
|
||
ARG VERSION=unknown | ||
ARG GITCOMMIT=unknown | ||
ARG BUILDTIME=unknown | ||
|
||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash git openssh | ||
|
||
RUN apk add --no-cache --no-progress \ | ||
ca-certificates \ | ||
make \ | ||
git \ | ||
openssh \ | ||
gcc \ | ||
libc-dev \ | ||
upx | ||
|
||
COPY . . | ||
RUN GO111MODULE=on go build \ | ||
-o tr1d1um_linux_amd64 \ | ||
-ldflags "-X 'main.BuildTime=${BUILDTIME}' -X main.GitCommit=${GITCOMMIT} -X main.Version=${VERSION}" | ||
RUN make build | ||
|
||
FROM scratch | ||
|
||
FROM alpine | ||
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/tr1d1um/tr1d1um.yaml /tr1d1um.yaml | ||
COPY --from=builder /go/src/github.com/xmidt-org/tr1d1um/tr1d1um /tr1d1um | ||
COPY --from=builder /go/src/github.com/xmidt-org/tr1d1um/deploy/Dockerfile /go/src/github.com/xmidt-org/tr1d1um/NOTICE /go/src/github.com/xmidt-org/tr1d1um/LICENSE /go/src/github.com/xmidt-org/tr1d1um/CHANGELOG.md / | ||
|
||
RUN apk --no-cache add ca-certificates | ||
RUN mkdir -p /etc/tr1d1um | ||
VOLUME /etc/tr1d1um | ||
EXPOSE 6100 | ||
EXPOSE 6101 | ||
EXPOSE 6102 | ||
EXPOSE 6103 | ||
|
||
EXPOSE 8080 | ||
USER nobody | ||
|
||
COPY --from=builder /go/src/github.com/xmidt-org/tr1d1um/tr1d1um_linux_amd64 / | ||
COPY tr1d1um.yaml / | ||
COPY deploy/Dockerfile NOTICE LICENSE CHANGELOG.md / | ||
ENTRYPOINT ["/tr1d1um_linux_amd64"] | ||
ENTRYPOINT ["/tr1d1um"] |
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/tr1d1um:$VERSION_TAG . | ||
|
||
docker push xmidt/tr1d1um:$VERSION_TAG | ||
|
||
if [[ "$VERSION_TAG" == "$LATEST_TAG" ]]; then | ||
docker tag xmidt/tr1d1um:$VERSION_TAG xmidt/tr1d1um:latest | ||
docker push xmidt/tr1d1um:latest | ||
fi |
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,6 @@ | ||
module github.com/xmidt-org/tr1d1um | ||
|
||
go 1.12 | ||
go 1.14 | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go v1.23.11 // indirect | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this command? If so, maybe
xmidt
would be a better name and we keep it the same across all Makefiles