-
Notifications
You must be signed in to change notification settings - Fork 4
Fix build stuff #10
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
base: 1.13_upgrade
Are you sure you want to change the base?
Fix build stuff #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,9 @@ | ||
| FROM golang:1.13-alpine as builder | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand the removal of this section due to the build script but I like the idea of keeping this part in there for other folks to have a nice way of building locally without having to run the full
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new version also requires you to build the binaries ahead of the Docker file which works fine for the pipeline but now forces people into a 2-step process when building locally. |
||
|
|
||
| ARG VERSION=master | ||
| ARG GOOS=linux | ||
|
|
||
| WORKDIR /vault-admin/ | ||
| COPY . . | ||
|
|
||
| RUN CGO_ENABLED=0 GOOS=${GOOS} go build -mod=vendor -ldflags "-X main.version=${VERSION}" -v -a -o vadmin . | ||
|
|
||
| CMD ["/bin/sh", "-c", "vadmin"] | ||
|
|
||
| # Stage 2 | ||
|
|
||
| FROM alpine:latest | ||
|
|
||
| RUN apk --no-cache add ca-certificates | ||
|
|
||
| ENV CONFIGURATION_PATH=/config | ||
|
|
||
| COPY --from=builder /vault-admin/vadmin /usr/bin | ||
| COPY /bin/vadmin-linux /usr/bin/vadmin | ||
|
|
||
| ENTRYPOINT ["vadmin"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/bin/bash | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this file broken out so we can all build consistently. |
||
|
|
||
| VERSION=${1:-custom} | ||
| GOOS=${2:-linux} | ||
|
|
||
| set -e | ||
|
|
||
| GO111MODULE=on CGO_ENABLED=0 GOOS=${GOOS} GOARCH=amd64 go build -mod=vendor -ldflags="-s -w -X main.version=${VERSION}" -a -o ./bin/vadmin-${GOOS} | ||
|
|
||
| cd bin | ||
| cp vadmin-${GOOS} vadmin | ||
| zip vadmin-${GOOS}-${VERSION}.zip vadmin | ||
| rm vadmin | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe leave the binary for local dev? |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/bin/bash | ||
|
|
||
| VERSION=${1:-master} | ||
| if [ "$VERSION" == "master" ]; then | ||
| VERSION="latest" | ||
| fi | ||
| PUBLISH=${2:-false} | ||
|
|
||
| set -e | ||
|
|
||
| echo "---------------------" | ||
| echo "Building vault-admin" | ||
| echo "---------------------" | ||
|
|
||
| docker run --rm -v "$PWD":/go/va -w /go/va golang:1.13-alpine \ | ||
| sh -c "apk add bash zip && ./build.sh ${VERSION} linux" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason to call |
||
| docker run --rm -v "$PWD":/go/va -w /go/va golang:1.13-alpine \ | ||
| sh -c "apk add bash zip && ./build.sh ${VERSION} darwin" | ||
|
|
||
| echo "" | ||
| echo "---------------------" | ||
| echo "Building vault-admin Container version: ${VERSION}" | ||
| echo "---------------------" | ||
|
|
||
| DTAG="premiereglobal/vault-admin:${VERSION}" | ||
|
|
||
| docker build . -t ${DTAG} | ||
|
|
||
| echo "---------------------" | ||
| echo "Created Tag ${DTAG}" | ||
| echo "---------------------" | ||
|
|
||
| if [[ ${PUBLISH} == "true" && -n $DOCKER_USERNAME && -n $DOCKER_PASSWORD ]]; then | ||
| echo "Pushing docker image: ${DTAG}" | ||
| docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" | ||
| docker push ${DTAG} | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| module github.com/PremiereGlobal/vault-admin | ||
|
|
||
| go 1.12 | ||
| go 1.13 | ||
|
|
||
| require ( | ||
| github.com/Sirupsen/logrus v1.0.6 | ||
|
|
||
This file was deleted.
This file was deleted.
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.
Looks like
publish_docker.shwas deleted?