From dcabd1ccc0fc6b0ed830498dc369db1c082ad9a6 Mon Sep 17 00:00:00 2001 From: Artem Smirnov Date: Thu, 13 Sep 2018 03:56:38 +0300 Subject: [PATCH] Remove unused files --- .gitignore | 1 - build.sh | 23 ----------------------- push.sh | 51 --------------------------------------------------- run.sh | 33 --------------------------------- shell.sh | 14 -------------- vars | 38 -------------------------------------- 6 files changed, 160 deletions(-) delete mode 100644 .gitignore delete mode 100755 build.sh delete mode 100755 push.sh delete mode 100755 run.sh delete mode 100755 shell.sh delete mode 100644 vars diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d5905e3..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -builds diff --git a/build.sh b/build.sh deleted file mode 100755 index 4904b8c..0000000 --- a/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -source vars - -DOCKERFILE="${1:-Dockerfile}" - -docker build -t "${REPO_NAME}/${APP_NAME}:${TAG}" -f ${DOCKERFILE} . - -# If the build was successful (0 exit code)... -if [ $? -eq 0 ]; then - echo - echo "Build of ${REPO_NAME}/${APP_NAME}:${TAG} completed OK" - echo - - # log build details to builds file - echo "`date` => ${REPO_NAME}/${APP_NAME}:${TAG}" >> builds - -# The build exited with an error. -else - echo "Build failed!" - exit 1 - -fi diff --git a/push.sh b/push.sh deleted file mode 100755 index a104e3d..0000000 --- a/push.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -source vars - -#This will take the latest locally built image and push it to the repository as -#configured in vars and tag it as latest. - -if [[ ! -f builds ]]; then - echo - echo "It appears that the Docker image hasn't been built yet, run build.sh first" - echo - exit 1 -fi - -LATESTIMAGE=`tail -1 builds | awk '{print $8}'` - -# Flatten is here as an option and not the default because with the export/import -# process we lose Dockerfile attributes like PORT and VOLUMES. Flattening helps if -# we are concerned about hitting the AUFS 42 layer limit or creating an image that -# other containers source FROM - -DockerExport () { - docker export ${APP_NAME} | docker import - ${REPO_NAME}/${APP_NAME}:latest -} - -DockerPush () { - docker push ${REPO_NAME}/${APP_NAME}:latest -} - -case "$1" in - flatten) - docker inspect ${APP_NAME} > /dev/null 2>&1 - if [[ $? -ne 0 ]]; then - echo "The ${APP_NAME} container doesn't appear to exist, exiting" - exit 1 - fi - RUNNING=`docker inspect ${APP_NAME} | python -c 'import sys, json; print json.load(sys.stdin)[0]["State"]["Running"]'` - if [[ "${RUNNING}" = "True" ]]; then - echo "Stopping ${APP_NAME} container for export" - docker stop ${APP_NAME} - DockerExport - DockerPush - else - DockerExport - DockerPush - fi - ;; - *) - docker tag -f ${LATESTIMAGE} ${REPO_NAME}/${APP_NAME}:latest - DockerPush -esac diff --git a/run.sh b/run.sh deleted file mode 100755 index 7439fe1..0000000 --- a/run.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -source vars - -#If there is a locally built image present, prefer that over the -#one in the registry, we're going to assume you're working on changes -#to the image. - -if [[ ! -f builds ]]; then - LATESTIMAGE=${REPO_NAME}/${APP_NAME}:latest -else - LATESTIMAGE=`tail -1 builds | awk '{print $8}'` -fi -echo -echo "Starting $APP_NAME..." -echo -echo -n "Container ID: " -docker run \ ---detach=true \ ---log-driver=syslog \ ---name="${APP_NAME}" \ ---restart=always \ --e FULL_NAME="${FULL_NAME}" \ --e EMAIL_ADDRESS="${EMAIL_ADDRESS}" \ --e GPG_PASSWORD="${GPG_PASSWORD}" \ --e HOSTNAME="${HOSTNAME}" \ --v ${APTLY_DATADIR}:/opt/aptly \ --p ${DOCKER_HOST_PORT}:80 \ -${LATESTIMAGE} -# Other useful options -# -p DOCKERHOST_PORT:CONTAINER_PORT \ -# -e "ENVIRONMENT_VARIABLE_NAME=VALUE" \ -# -v /DOCKERHOST/PATH:/CONTAINER/PATH \ diff --git a/shell.sh b/shell.sh deleted file mode 100755 index 4c5bf04..0000000 --- a/shell.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -source vars - -PYTHON=`which python || which python3` - -docker inspect ${APP_NAME} > /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "The ${APP_NAME} container doesn't appear to exist, exiting" -fi - -CONTAINER_ID=`docker inspect ${APP_NAME} | $PYTHON -c 'import sys, json; print(json.load(sys.stdin)[0]["Id"])'` - -docker exec -it ${CONTAINER_ID} /bin/bash diff --git a/vars b/vars deleted file mode 100644 index ef1c2a9..0000000 --- a/vars +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -#### BEGIN APP SPECIFIC VARIABLES - -# Name of the container -APP_NAME=aptly -# Docker Hub Username or internal registry (e.g. docker-registry.example.com:5000) -REPO_NAME="myusername" - -# Name used on repository signing key -FULL_NAME="First Last" -# Email address of the repository key signer -EMAIL_ADDRESS=user@example.com -# Password used to encrypt the signing key -GPG_PASSWORD=repo1234 -# The directory on the Docker host to store repository data -APTLY_DATADIR=/tmp/path/to/lots/of/space -# FQDN of the Docker host that the aptly container will run on -HOSTNAME=aptly.example.com -# TCP port that aptly will be reachable on, set to something else if you already -# have a web server running on your Docker host -DOCKER_HOST_PORT=80 - -#### END APP SPECIFIC VARIABLES -#### BEGIN GENERIC VARIABLES - -# Get an SHA sum of all files involved in building the image so the image can be tagged -# this will provide assurance that any image with the same tag was built the same way. -SHASUM=`find . -type f \ - -not -path "*/.git/*" \ - -not -path "*.gitignore*" \ - -not -path "*builds*" \ - -not -path "*run.sh*" \ - -exec shasum {} + | awk '{print $1}' | sort | shasum | cut -c1-4` - -TAG="`date +%Y%m%d`-${SHASUM}" - -#### END GENERIC VARIABLES