Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ language: minimal
services:
- docker
script:
- scripts/build.sh ${TRAVIS_BRANCH} linux
- scripts/build.sh ${TRAVIS_BRANCH} darwin
- ./dockerBuild.sh ${TRAVIS_BRANCH}
deploy:
- provider: releases
api_key:
secure: x0x8TSocUv6fQ9xO5d/Ehn/iFypcqS0GzvycW1tXxPbG/m0I+PEsEDkCvia6Le5aa9uCPS/3DiCkt6h4sZEnWXqsWBAyaEXbAZgNCMT+NXSalgNsA/mHZi+EItzzwgi00vzHK7G6DFl2wZZq/11OGTngu2Xxin64EnnO2j55uCDkgX6Ifc5P0nD343ZJU8vb0hYEnjV6WvVWBYNINJOqEyyT+QjsSHWWzouVbkLlrBL8WmbvFDgmOAWASQWJqiyuuVrDCVufgCSWRikREUIJxFl65636RQ9Yau4l4JypC+OcYu5yxKN8cL/Yf09Nf7fFbYLk/REK0w57o/xbjDm6T6RIg4UDEBpG+29AZiz20m6c8V6sKo0IZL1rPh+k8OgWOKPZENakIdrxC3levRE8nxysG3f5w04sKFKD7g4kymLKPYSDkOxkHQiMJlccok0AkTa37BeqDqgPFfjkvnM18BUpPeolwNchB07/i62aREdmER9DTXQEsvdpwTOYMt6WDqasnVjvVMoudkEputV8NbJLf/st6OJdFjdMz3rfGbeM5aRNbf1Lz+lQBH1nGgVbc6/OddxdFJz1lXV4p8Ml9EOaMwiM7LjuqY45V8Xl9+XLeob0pRGZMROnye3lpmSQsxaQdta/S5Zlorz3IM5M3Qr3htuYID2NOrAPlGe3+ZM=
file_glob: true
file: bin/*
file: bin/*.zip
skip_cleanup: true
on:
tags: true
- provider: script
script: bash scripts/publish_docker.sh ${TRAVIS_BRANCH}
script: bash scripts/publish_docker.sh ${TRAVIS_BRANCH} true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like publish_docker.sh was deleted?

on:
tags: true
- provider: script
script: bash scripts/publish_docker.sh ${TRAVIS_BRANCH} latest
script: bash scripts/publish_docker.sh ${TRAVIS_BRANCH} true
on:
branch: master
env:
Expand Down
16 changes: 1 addition & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
FROM golang:1.13-alpine as builder
Copy link
Contributor

Choose a reason for hiding this comment

The 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 buildDocker.sh script.

Copy link
Contributor

Choose a reason for hiding this comment

The 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"]
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe leave the binary for local dev?


37 changes: 37 additions & 0 deletions dockerBuild.sh
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to call apk add bash zip twice here? Also, that means this script will only work on alpine machines (can't run this file on other flavors or macos)?

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
2 changes: 1 addition & 1 deletion go.mod
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
Expand Down
20 changes: 0 additions & 20 deletions scripts/build.sh

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/publish_docker.sh

This file was deleted.