Remove unused files

This commit is contained in:
Artem Smirnov 2018-09-13 03:56:38 +03:00
parent 53df87670a
commit dcabd1ccc0
6 changed files with 0 additions and 160 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
builds

View File

@ -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

51
push.sh
View File

@ -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

33
run.sh
View File

@ -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 \

View File

@ -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

38
vars
View File

@ -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