Chris Kankiewicz
5 years ago
No known key found for this signature in database
GPG Key ID: 474E915709CEB5EB
3 changed files with
9 additions and
70 deletions
-
.dockerignore
-
Makefile
-
build.sh
|
|
@ -1,4 +1,4 @@ |
|
|
|
.git |
|
|
|
build.sh |
|
|
|
LICENSE |
|
|
|
Makefile |
|
|
|
README.md |
|
|
@ -0,0 +1,8 @@ |
|
|
|
IMAGE_NAME="phlak/mumble" |
|
|
|
IMAGE_TAG="$$(grep 'ARG MUMBLE_VERSION' Dockerfile | awk -F = '{print $$2}')" |
|
|
|
|
|
|
|
build: |
|
|
|
@docker build --force-rm --pull --tag $(IMAGE_NAME):$(IMAGE_TAG) . |
|
|
|
|
|
|
|
purge: |
|
|
|
@docker image rm --force $(IMAGE_NAME):$(IMAGE_TAG) |
|
|
@ -1,69 +0,0 @@ |
|
|
|
#!/usr/bin/env bash |
|
|
|
set -o errexit |
|
|
|
|
|
|
|
## PRE-RUN SETUP & CONFIGURATION |
|
|
|
######################################## |
|
|
|
|
|
|
|
SCRIPT_DIR="$(dirname $(readlink -f ${0}))" |
|
|
|
|
|
|
|
IMAGE_NAME="phlak/mumble" |
|
|
|
TAG="$(grep 'ARG MUMBLE_VERSION' Dockerfile | awk -F = '{print $2}')" |
|
|
|
|
|
|
|
## SCRIPT USAGE |
|
|
|
######################################## |
|
|
|
|
|
|
|
function usageShort() { |
|
|
|
echo "Usage: $(basename ${0}) [OPTIONS]" |
|
|
|
} |
|
|
|
|
|
|
|
function usageLong() { |
|
|
|
|
|
|
|
usageShort |
|
|
|
|
|
|
|
cat <<-EOF |
|
|
|
|
|
|
|
OPTIONS: |
|
|
|
|
|
|
|
-h, --help Print this help dialogue |
|
|
|
-p, --purge Purge the image after build |
|
|
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
## OPTION / PARAMATER PARSING |
|
|
|
######################################## |
|
|
|
|
|
|
|
PARSED_OPTIONS=$(getopt -n "${0}" -o hp -l "help,purge" -- "$@") |
|
|
|
|
|
|
|
eval set -- "${PARSED_OPTIONS}" |
|
|
|
|
|
|
|
while true; do |
|
|
|
case "${1}" in |
|
|
|
-h|--help) usageLong; exit ;; |
|
|
|
-p|--purge) PURGE=true; shift ;; |
|
|
|
--) shift; break ;; |
|
|
|
esac |
|
|
|
done |
|
|
|
|
|
|
|
## SCRIPT FUNCTIONS |
|
|
|
######################################## |
|
|
|
|
|
|
|
function buildImage() { |
|
|
|
docker build --force-rm --pull --tag ${IMAGE_NAME}:${TAG} ${SCRIPT_DIR} |
|
|
|
} |
|
|
|
|
|
|
|
function purgeImage() { |
|
|
|
docker rmi --force ${IMAGE_NAME}:${TAG} |
|
|
|
echo "Purged image: ${IMAGE_NAME}:${TAG}" |
|
|
|
} |
|
|
|
|
|
|
|
function main() { |
|
|
|
buildImage; [[ "${PURGE}" == true ]] && purgeImage |
|
|
|
echo "Successfully built ${IMAGE_NAME}:${TAG}" |
|
|
|
} |
|
|
|
|
|
|
|
# MAKE IT SO |
|
|
|
######################################## |
|
|
|
|
|
|
|
main |