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

Adding docker image and release scripts #123

Merged
merged 14 commits into from
Aug 16, 2017
Merged

Conversation

anubhavmishra
Copy link
Collaborator

@anubhavmishra anubhavmishra commented Aug 16, 2017

  • Adding a Dockerfile
  • Switched to CircleCI version 2
  • Created a release process for our binaries for different platforms
  • We now use CircleCI to push docker images

Fixes: #105

Dockerfile Outdated
@@ -0,0 +1,46 @@
FROM alpine:3.4
MAINTAINER Anubhav Mishra <anubhav.mishra@hootsuite.com>
Copy link
Collaborator

Choose a reason for hiding this comment

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

what about me?!?!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also MAINTAINER is deprecated now, use LABEL maintainer="SvenDowideit@home.org.au" instead (see https://docs.docker.com/engine/reference/builder/#maintainer-deprecated)

Dockerfile Outdated
@@ -0,0 +1,46 @@
FROM alpine:3.4
Copy link
Collaborator

Choose a reason for hiding this comment

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

someone else mentioned this (can't find where) but you should use 3.6 since it's the latest

Dockerfile Outdated
FROM alpine:3.4
MAINTAINER Anubhav Mishra <anubhav.mishra@hootsuite.com>

ENV DOCKER_BASE_VERSION=0.0.4
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add the comment from here: https://github.com/hashicorp/docker-consul/blob/master/0.X/Dockerfile#L8 otherwise unclear what this is for

fi

# Look for atlantis subcommands.
if [ "$1" = '--version' ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't have a --version flag

Dockerfile Outdated
gpg --batch --verify docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS.sig docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS && \
grep ${DOCKER_BASE_VERSION}_linux_amd64.zip docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS | sha256sum -c && \
unzip docker-base_${DOCKER_BASE_VERSION}_linux_amd64.zip && \
cp bin/gosu bin/dumb-init /bin && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["server"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

just curious how big is the container in the end?

# We can't use the return code to check for the existence of a subcommand, so
# we have to use grep to look for a pattern in the help output.
set -- atlantis "$@"
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you check if we need all this?

@anubhavmishra
Copy link
Collaborator Author

Finally got it working with CircleCI version 2! Mark spend a day on this, now I know why. :(

command: make end-to-end-deps
- run:
name: Starting atlantis server in the background
command: cd "${CIRCLE_WORKING_DIRECTORY}/e2e" && ./atlantis server --gh-user="$GITHUB_USERNAME" --gh-token="$GITHUB_PASSWORD" --data-dir="/tmp" --log-level="debug" &> /tmp/atlantis-server.log
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we add the webhook-secret as well?

# https://discuss.circleci.com/t/git-tag-deploys-in-2-0/9493/6
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
for TAG in $(git tag --contains $CIRCLE_SHA1); do
Copy link
Collaborator

Choose a reason for hiding this comment

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

so this checks if there's a tag for this commit and if so pushes a new docker image? Doesn't this build run on master so how will there be a tag at the time that this build runs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea, so CircleCI doesn't have support for tagged events from Github. So we will merge something to master, create a tag and then rebuild on master to push the docker image.

@@ -258,6 +258,44 @@ $ atlantis server --atlantis-url $URL --gh-user $USERNAME --gh-token $TOKEN --gh
Atlantis is now running!
**We recommend running it under something like Systemd or Supervisord.**

### Docker
Copy link
Collaborator

Choose a reason for hiding this comment

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

add to the outline at the top

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

README.md Outdated
@@ -258,6 +258,44 @@ $ atlantis server --atlantis-url $URL --gh-user $USERNAME --gh-token $TOKEN --gh
Atlantis is now running!
**We recommend running it under something like Systemd or Supervisord.**

### Docker
Atlantis also ships inside a docker image along side Terraform binaries. Run the docker image:
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe instead of "along side Ter.." say "Atlantis also ships inside a Docker image with Terraform versions 0.8.8, 0.9.11 and 0.10.0"? Probably better to be clear about what's in the Docker image so people don't have to look at the Dockerfile

README.md Outdated
# copy aws credentials
COPY credentials /home/atlantis/.aws/credentials

ENTRYPOINT ["docker-entrypoint.sh"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to redefine the ENTRYPOINT and CMD?

Copy link
Collaborator

Choose a reason for hiding this comment

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

just tested it, we don't need to redefine them, they're inherited.

README.md Outdated
* Build docker image

```bash
docker build -t hootsuite/atlantis-custom -f Dockerfile-custom
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably wouldn't make sense for them to name it hootsuite/atlantis-custom since they don't be able to push to our Docker registry. Maybe just say docker build -t {your-docker-org}/atlantis-custom?

README.md Outdated
* Run docker image

```bash
docker run -it hootsuite/atlantis-custom server --gh-user=GITHUB_USERNAME --gh-token=GITHUB_TOKEN
Copy link
Collaborator

Choose a reason for hiding this comment

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

they don't need to run -it do they?


# cd into e2e folder
cd e2e/
# Decrypting secrets for atlantis runtime: https://github.com/circleci/encrypted-files
openssl aes-256-cbc -d -in secrets-envs -k $KEY >> ~/.circlerc
# openssl aes-256-cbc -d -in secrets-envs -k $KEY >> ~/.circlerc
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't need this anymore? can we delete it?

@anubhavmishra anubhavmishra merged commit 6b55b08 into master Aug 16, 2017
@anubhavmishra anubhavmishra deleted the docker-image-release branch August 16, 2017 20:29
@so0k
Copy link
Contributor

so0k commented Aug 17, 2017

Cool! wouldn't it be necessary to use a filter for the ngrok query (based on the protocol)

Like I did here: https://github.com/honestbee/atlantis/commit/f76eb19e62f2f42aa7441a0c2e6bf235cf9a363b#diff-fd8635a5248b5832a7faf06a8e572e17R12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants