Skip to content

Commit

Permalink
add docker build and file
Browse files Browse the repository at this point in the history
  • Loading branch information
billiford committed Sep 4, 2020
1 parent 8573268 commit 17dd201
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine
RUN apk add --no-cache ca-certificates curl
COPY arcade /usr/local/bin
CMD ["/usr/local/bin/arcade"]
54 changes: 54 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

set -o errexit

# Builds the base image including the solver dependencies
build_and_publish_image(){
GOOS=linux GOARCH=amd64 go build cmd/arcade/arcade.go
GCR_TAG="billiford/arcade:${TAG_VERSION}"
docker build . -f docker/Dockerfile -t ${GCR_TAG}
docker push ${GCR_TAG}
}

print_help(){
echo ""
echo "docker/build.sh -v [VERSION] - Builds the docker image"
echo ""
echo "FLAGS"
echo " -v [version]"
echo " The version to be used in the docker tag"
echo ""
}

if [[ $# -eq 0 ]]; then
print_help
exit 1
fi

# Check for arguments
while [[ $# -gt 0 ]]; do
key="${1}"
case ${key} in
-v)
shift
if [ -z "${1}" ]; then
print_help
else
echo "Building base image with version: [${1}]"
TAG_VERSION="${1}"
build_and_publish_image
fi
exit 0
;;
--help)
shift
print_help
exit 0
;;
*)
echo "ERROR: Unrecognized argument ${key}"
print_help
exit 1
;;
esac
done

0 comments on commit 17dd201

Please sign in to comment.