summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Smirnov <urpylka@gmail.com>2018-09-13 03:56:38 +0300
committerArtem Smirnov <urpylka@gmail.com>2018-09-14 00:41:10 +0300
commitdcabd1ccc0fc6b0ed830498dc369db1c082ad9a6 (patch)
tree3a35d406175b97997e0772f91a424bacad2f8bc7
parent53df87670a9aa499c0fb787e05118eb37226e396 (diff)
Remove unused files
-rw-r--r--.gitignore1
-rwxr-xr-xbuild.sh23
-rwxr-xr-xpush.sh51
-rwxr-xr-xrun.sh33
-rwxr-xr-xshell.sh14
-rw-r--r--vars38
6 files changed, 0 insertions, 160 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index d5905e3..0000000
--- a/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1builds
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 4904b8c..0000000
--- a/build.sh
+++ /dev/null
@@ -1,23 +0,0 @@
1#!/bin/bash
2
3source vars
4
5DOCKERFILE="${1:-Dockerfile}"
6
7docker build -t "${REPO_NAME}/${APP_NAME}:${TAG}" -f ${DOCKERFILE} .
8
9# If the build was successful (0 exit code)...
10if [ $? -eq 0 ]; then
11 echo
12 echo "Build of ${REPO_NAME}/${APP_NAME}:${TAG} completed OK"
13 echo
14
15 # log build details to builds file
16 echo "`date` => ${REPO_NAME}/${APP_NAME}:${TAG}" >> builds
17
18# The build exited with an error.
19else
20 echo "Build failed!"
21 exit 1
22
23fi
diff --git a/push.sh b/push.sh
deleted file mode 100755
index a104e3d..0000000
--- a/push.sh
+++ /dev/null
@@ -1,51 +0,0 @@
1#!/bin/bash
2
3source vars
4
5#This will take the latest locally built image and push it to the repository as
6#configured in vars and tag it as latest.
7
8if [[ ! -f builds ]]; then
9 echo
10 echo "It appears that the Docker image hasn't been built yet, run build.sh first"
11 echo
12 exit 1
13fi
14
15LATESTIMAGE=`tail -1 builds | awk '{print $8}'`
16
17# Flatten is here as an option and not the default because with the export/import
18# process we lose Dockerfile attributes like PORT and VOLUMES. Flattening helps if
19# we are concerned about hitting the AUFS 42 layer limit or creating an image that
20# other containers source FROM
21
22DockerExport () {
23 docker export ${APP_NAME} | docker import - ${REPO_NAME}/${APP_NAME}:latest
24}
25
26DockerPush () {
27 docker push ${REPO_NAME}/${APP_NAME}:latest
28}
29
30case "$1" in
31 flatten)
32 docker inspect ${APP_NAME} > /dev/null 2>&1
33 if [[ $? -ne 0 ]]; then
34 echo "The ${APP_NAME} container doesn't appear to exist, exiting"
35 exit 1
36 fi
37 RUNNING=`docker inspect ${APP_NAME} | python -c 'import sys, json; print json.load(sys.stdin)[0]["State"]["Running"]'`
38 if [[ "${RUNNING}" = "True" ]]; then
39 echo "Stopping ${APP_NAME} container for export"
40 docker stop ${APP_NAME}
41 DockerExport
42 DockerPush
43 else
44 DockerExport
45 DockerPush
46 fi
47 ;;
48 *)
49 docker tag -f ${LATESTIMAGE} ${REPO_NAME}/${APP_NAME}:latest
50 DockerPush
51esac
diff --git a/run.sh b/run.sh
deleted file mode 100755
index 7439fe1..0000000
--- a/run.sh
+++ /dev/null
@@ -1,33 +0,0 @@
1#!/bin/bash
2
3source vars
4
5#If there is a locally built image present, prefer that over the
6#one in the registry, we're going to assume you're working on changes
7#to the image.
8
9if [[ ! -f builds ]]; then
10 LATESTIMAGE=${REPO_NAME}/${APP_NAME}:latest
11else
12 LATESTIMAGE=`tail -1 builds | awk '{print $8}'`
13fi
14echo
15echo "Starting $APP_NAME..."
16echo
17echo -n "Container ID: "
18docker run \
19--detach=true \
20--log-driver=syslog \
21--name="${APP_NAME}" \
22--restart=always \
23-e FULL_NAME="${FULL_NAME}" \
24-e EMAIL_ADDRESS="${EMAIL_ADDRESS}" \
25-e GPG_PASSWORD="${GPG_PASSWORD}" \
26-e HOSTNAME="${HOSTNAME}" \
27-v ${APTLY_DATADIR}:/opt/aptly \
28-p ${DOCKER_HOST_PORT}:80 \
29${LATESTIMAGE}
30# Other useful options
31# -p DOCKERHOST_PORT:CONTAINER_PORT \
32# -e "ENVIRONMENT_VARIABLE_NAME=VALUE" \
33# -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 @@
1#!/bin/bash
2
3source vars
4
5PYTHON=`which python || which python3`
6
7docker inspect ${APP_NAME} > /dev/null 2>&1
8if [[ $? -ne 0 ]]; then
9 echo "The ${APP_NAME} container doesn't appear to exist, exiting"
10fi
11
12CONTAINER_ID=`docker inspect ${APP_NAME} | $PYTHON -c 'import sys, json; print(json.load(sys.stdin)[0]["Id"])'`
13
14docker 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 @@
1#!/bin/bash
2
3#### BEGIN APP SPECIFIC VARIABLES
4
5# Name of the container
6APP_NAME=aptly
7# Docker Hub Username or internal registry (e.g. docker-registry.example.com:5000)
8REPO_NAME="myusername"
9
10# Name used on repository signing key
11FULL_NAME="First Last"
12# Email address of the repository key signer
13EMAIL_ADDRESS=user@example.com
14# Password used to encrypt the signing key
15GPG_PASSWORD=repo1234
16# The directory on the Docker host to store repository data
17APTLY_DATADIR=/tmp/path/to/lots/of/space
18# FQDN of the Docker host that the aptly container will run on
19HOSTNAME=aptly.example.com
20# TCP port that aptly will be reachable on, set to something else if you already
21# have a web server running on your Docker host
22DOCKER_HOST_PORT=80
23
24#### END APP SPECIFIC VARIABLES
25#### BEGIN GENERIC VARIABLES
26
27# Get an SHA sum of all files involved in building the image so the image can be tagged
28# this will provide assurance that any image with the same tag was built the same way.
29SHASUM=`find . -type f \
30 -not -path "*/.git/*" \
31 -not -path "*.gitignore*" \
32 -not -path "*builds*" \
33 -not -path "*run.sh*" \
34 -exec shasum {} + | awk '{print $1}' | sort | shasum | cut -c1-4`
35
36TAG="`date +%Y%m%d`-${SHASUM}"
37
38#### END GENERIC VARIABLES