Skip to content
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

Added new deploy container and improved build process #44

Merged
merged 3 commits into from
Feb 4, 2020
Merged
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
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ deploy:
on:
tags: true
- provider: script
script: bash scripts/publish_docker.sh ${TRAVIS_BRANCH}
script:
- scripts/publish_docker.sh ${TRAVIS_BRANCH} ${TRAVIS_BRANCH}
- scripts/publish_docker.sh ${TRAVIS_BRANCH}-deploy ${TRAVIS_BRANCH}-deploy
- scripts/publish_docker.sh ${TRAVIS_BRANCH} latest
- scripts/publish_docker.sh ${TRAVIS_BRANCH}-deploy latest-deploy
on:
tags: true
- provider: script
script: bash scripts/publish_docker.sh ${TRAVIS_BRANCH} latest
script:
- scripts/publish_docker.sh ${TRAVIS_BRANCH} master
- scripts/publish_docker.sh ${TRAVIS_BRANCH} master-deploy
on:
branch: master
env:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Stim Changelog

## 0.1.4

### Improvements
* Added new Docker image with the format `premiereglobal/stim:v0.1.4-deploy`. This container provides additional features for deployments with stim
* Contains additional deploy utilities such as: `bash`, `curl`, `zip`, `jq`, `less`, `python`, `git`, `yq`, and `aws`
* Entrypoint is `bash` to make it easier to run with custom commands
* Updated Docker tagging
* Master builds will now have the Docker tag `master` and `master-deploy`, with the `stim version` of `stim/master`
* Tagged releases will continue having the tag scheme `v0.1.4` and `v0.1.4-deploy`, but will also update the latest tags `latest` and `latest-deploy`. Doing `stim version` on any `latest` image will now reveal the actual version `stim/vX.X.X`, instead of `stim/master`.

## 0.1.3

### Improvements
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile.deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG STIM_IMAGE
FROM $STIM_IMAGE

RUN \
set -x && \
apk update && \
apk -Uuv add bash curl zip jq groff less python py2-pip wget ca-certificates openssl git apache2-utils && \
pip install awscli yq && \
apk --purge -v del py2-pip && \
rm /var/cache/apk/*

ENTRYPOINT ["/bin/bash", "-c"]
2 changes: 1 addition & 1 deletion docs/DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Stim can be used to deploy to Kubernetes using Vault to configure a deployment environment.

## Prerequisites
This functionality relies on a running [Docker](https://docs.docker.com/install/) daemon. It can also be run inside a container.
This functionality relies on a running [Docker](https://docs.docker.com/install/) daemon. It can also be run inside a container. If running inside a container, it is recommended that you use the `premiereglobal/stim:vx.x.x-deploy` image as it contains additional utilities (such as `bash`) which are useful for deploys.

## Usage

Expand Down
17 changes: 9 additions & 8 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ DOCKER_REPO="premiereglobal/stim"
# Directory to house our binaries
mkdir -p bin

# Build the binary in Docker
# Build the container
docker build --build-arg VERSION=${VERSION} --build-arg GOOS=${GOOS} -t ${DOCKER_REPO}:${VERSION}-${GOOS} ./

# Run the container in the background in order to extract the binary
docker run --rm --entrypoint "" --name stim-build -d ${DOCKER_REPO}:${VERSION}-${GOOS} sh -c "sleep 120"

docker cp stim-build:/usr/bin/stim bin
docker stop stim-build
# Extract the binary from the container
docker run --rm --entrypoint "" --name stim-build -v $(pwd)/bin:/stim-bin ${DOCKER_REPO}:${VERSION}-${GOOS} sh -c "cp /usr/bin/stim /stim-bin"

# Zip up the binary
cd bin
tar -cvzf stim-${GOOS}-${VERSION}.tar.gz stim

# Get us back to the root
cd ..

# Build the deploy container
# This command uses the image we just built above as the base image
if [[ ${GOOS} == "linux" ]]; then
docker build --build-arg STIM_IMAGE=${DOCKER_REPO}:${VERSION}-${GOOS} -f Dockerfile.deploy -t ${DOCKER_REPO}:${VERSION}-deploy-${GOOS} ./
fi