-
Notifications
You must be signed in to change notification settings - Fork 48
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
Changes from 1 commit
97dbd9b
9a465d9
4a9e845
f283ad9
0e5c5b3
eba37fe
b13ca42
a2f8b15
7b7426b
003c412
10590dd
89420d2
4c576f0
82a7195
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ atlantis | |
*.iml | ||
.vscode | ||
atlantis.db | ||
output |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM alpine:3.4 | ||
MAINTAINER Anubhav Mishra <anubhav.mishra@hootsuite.com> | ||
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. what about me?!?! 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. Also |
||
|
||
ENV DOCKER_BASE_VERSION=0.0.4 | ||
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. 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 |
||
|
||
# create atlantis user | ||
RUN addgroup atlantis && \ | ||
adduser -S -G atlantis atlantis | ||
|
||
ENV ATLANTIS_HOME_DIR=/home/atlantis | ||
|
||
# install atlantis dependencies | ||
RUN apk add --no-cache ca-certificates gnupg curl git unzip bash openssh libcap openssl && \ | ||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 91A6E7F85D05C65630BEF18951852D87348FFC4C && \ | ||
mkdir -p /tmp/build && \ | ||
cd /tmp/build && \ | ||
wget https://releases.hashicorp.com/docker-base/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_linux_amd64.zip && \ | ||
wget https://releases.hashicorp.com/docker-base/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS && \ | ||
wget https://releases.hashicorp.com/docker-base/${DOCKER_BASE_VERSION}/docker-base_${DOCKER_BASE_VERSION}_SHA256SUMS.sig && \ | ||
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 && \ | ||
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. is this all just to get gosu and dumb-init? Why not install directly https://github.com/Yelp/dumb-init#option-3-downloading-the-binary-directly |
||
cd /tmp && \ | ||
rm -rf /tmp/build && \ | ||
apk del gnupg openssl && \ | ||
rm -rf /root/.gnupg && rm -rf /var/cache/apk/* | ||
|
||
# install terraform binaries | ||
ENV DEFAULT_TERRAFORM_VERSION=0.10.0 | ||
|
||
RUN AVAILABLE_TERRAFORM_VERSIONS="0.8.8 0.9.11 0.10.0" && \ | ||
for VERSION in ${AVAILABLE_TERRAFORM_VERSIONS}; do curl -LOk https://releases.hashicorp.com/terraform/${VERSION}/terraform_${VERSION}_linux_amd64.zip && \ | ||
mkdir -p /usr/local/bin/tf/versions/${VERSION} && \ | ||
unzip terraform_${VERSION}_linux_amd64.zip -d /usr/local/bin/tf/versions/${VERSION} && \ | ||
ln -s /usr/local/bin/tf/versions/${VERSION}/terraform /usr/local/bin/terraform${VERSION};done && \ | ||
ln -s /usr/local/bin/tf/versions/${DEFAULT_TERRAFORM_VERSION}/terraform /usr/local/bin/terraform | ||
|
||
# copy binary | ||
COPY atlantis /usr/local/bin/atlantis | ||
|
||
# copy docker entrypoint | ||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
CMD ["server"] | ||
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. just curious how big is the container in the end? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/dumb-init /bin/sh | ||
set -e | ||
|
||
# Original: https://github.com/hashicorp/docker-consul/blob/2c2873f9d619220d1eef0bc46ec78443f55a10b5/0.X/docker-entrypoint.sh | ||
|
||
# Note above that we run dumb-init as PID 1 in order to reap zombie processes | ||
# as well as forward signals to all processes in its session. Normally, sh | ||
# wouldn't do either of these functions so we'd leak zombies as well as do | ||
# unclean termination of all our sub-processes. | ||
|
||
# If the user is trying to run atlantis directly with some arguments, then | ||
# pass them to atlantis. | ||
if [ "${1:0:1}" = '-' ]; then | ||
set -- atlantis "$@" | ||
fi | ||
|
||
# Look for atlantis subcommands. | ||
if [ "$1" = '--version' ]; then | ||
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. we don't have a |
||
# This needs a special case because there's no help output. | ||
set -- atlantis "$@" | ||
elif atlantis --help "$1" 2>&1 | grep -q "atlantis $1"; then | ||
# 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 | ||
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. can you check if we need all this? |
||
|
||
# If we are running atlantis, make sure it executes as the proper user. | ||
if [ "$1" = 'atlantis' ]; then | ||
# If requested, set the capability to bind to privileged ports before | ||
# we drop to the non-root user. Note that this doesn't work with all | ||
# storage drivers (it won't work with AUFS). | ||
if [ ! -z ${ATLANTIS_ALLOW_PRIVILEGED_PORTS+x} ]; then | ||
setcap "cap_net_bind_service=+ep" /bin/atlantis | ||
fi | ||
|
||
set -- gosu atlantis "$@" | ||
fi | ||
|
||
exec "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# define architecture we want to build | ||
XC_ARCH=${XC_ARCH:-"386 amd64 arm"} | ||
XC_OS=${XC_OS:-linux darwin} | ||
XC_EXCLUDE_OSARCH="!darwin/arm !darwin/386" | ||
|
||
# clean up | ||
echo "-> running clean up...." | ||
rm -rf output/* | ||
|
||
if ! which gox > /dev/null; then | ||
echo "-> installing gox..." | ||
go get -u github.com/mitchellh/gox | ||
fi | ||
|
||
# build | ||
# we want to build statically linked binaries | ||
export CGO_ENABLED=0 | ||
echo "-> building..." | ||
gox \ | ||
-os="${XC_OS}" \ | ||
-arch="${XC_ARCH}" \ | ||
-osarch="${XC_EXCLUDE_OSARCH}" \ | ||
-output "output/{{.OS}}_{{.Arch}}/atlantis" \ | ||
. | ||
|
||
# Zip and copy to the dist dir | ||
echo "" | ||
echo "Packaging..." | ||
for PLATFORM in $(find ./output -mindepth 1 -maxdepth 1 -type d); do | ||
OSARCH=$(basename ${PLATFORM}) | ||
echo "--> ${OSARCH}" | ||
|
||
pushd $PLATFORM >/dev/null 2>&1 | ||
zip ../atlantis_${OSARCH}.zip ./* | ||
popd >/dev/null 2>&1 | ||
done | ||
|
||
echo "" | ||
echo "" | ||
echo "-----------------------------------" | ||
echo "Output:" | ||
ls -alh output/ |
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.
someone else mentioned this (can't find where) but you should use 3.6 since it's the latest