From 53d124bd7d5038f51c70245f37ddd81495507c17 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:32:20 -0700 Subject: [PATCH 1/7] Switching to python slim --- Dockerfile | 5 +++-- build_and_deploy.sh | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 24364c27..9df5271e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ -FROM python -RUN pip3 install requests discord.py docker pybooru && \ +FROM python:3.6.2-slim +RUN apt-get update && apt-get install -y curl &&\ + pip3 install requests discord.py docker pybooru && \ curl -Lks get.docker.com | bash ADD dragon-bot.py / diff --git a/build_and_deploy.sh b/build_and_deploy.sh index 70ddf066..e0092b51 100755 --- a/build_and_deploy.sh +++ b/build_and_deploy.sh @@ -1,7 +1,7 @@ # Put the latest version of the dragon-bot.py in the container -printf "[-] Rebuilding container with latest code\n" -docker build -t dragon-bot . -printf "[+] Done\n" +# printf "[-] Rebuilding container with latest code\n" +# docker build -t dragon-bot . +# printf "[+] Done\n" # Remove the running container so we cna re-use the container name 'dragon-bot' printf "\n[-] Deleting old dragon-bot container from system\n" @@ -10,5 +10,5 @@ printf "[+] Done\n" # Run that shit and mount the docker socket so it can talk to the sky-factory container printf "\n[-] Starting up latest build of container\n" -docker run -d --name dragon-bot -v /var/run/docker.sock:/var/run/docker.sock --restart always dragon-bot +docker run -d --name dragon-bot -v /var/run/docker.sock:/var/run/docker.sock --restart always ldooks/dragon-bot printf "[+] Done\n" From ceb13c5ab6063f6a89fe13a0fcab2efcc20fcb14 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:36:39 -0700 Subject: [PATCH 2/7] Only push container on successful build --- bitbucket-pipelines.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index c5462736..a3710212 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -18,7 +18,16 @@ pipelines: # build the Docker image (this will use the Dockerfile in the root of the repo) - docker build -t $IMAGE_NAME . - # authenticate with the Docker Hub registry - - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD - # push the new Docker image to the Docker registry - - docker push $IMAGE_NAME \ No newline at end of file + branches: + master: + - step: + script: + # authenticate with the Docker Hub registry + - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD + # push the new Docker image to the Docker registry + - docker push $IMAGE_NAME + feature/*: + - step: + image: yourdockerusername/imagename # This step uses its own image + script: + - echo "This script runs only on commit to branches with names that match the feature/* pattern." From b81fce458d45ea9b1594e2a64583c3c9f5475103 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:45:12 -0700 Subject: [PATCH 3/7] updating pipeline script --- bitbucket-pipelines.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index a3710212..a9059567 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -12,22 +12,23 @@ options: pipelines: default: - step: - script: # Modify the commands below to build your repository. + script: # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings - export IMAGE_NAME=ldooks/dragon-bot:latest - - # build the Docker image (this will use the Dockerfile in the root of the repo) - - docker build -t $IMAGE_NAME . - branches: - master: - - step: - script: - # authenticate with the Docker Hub registry - - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD - # push the new Docker image to the Docker registry - - docker push $IMAGE_NAME - feature/*: - - step: - image: yourdockerusername/imagename # This step uses its own image - script: - - echo "This script runs only on commit to branches with names that match the feature/* pattern." + branches: + master: + - step: + script: + # build the Docker image (this will use the Dockerfile in the root of the repo) + - docker build -t $IMAGE_NAME . + # authenticate with the Docker Hub registry + - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD + # push the new Docker image to the Docker registry + - docker push $IMAGE_NAME + feature/*: + - step: + image: $IMAGE_NAME + script: + # Only build iamges, dont push when we're on a feature branch + # build the Docker image (this will use the Dockerfile in the root of the repo) + - docker build -t $IMAGE_NAME . \ No newline at end of file From 39a0bd3c6e90b5763cc870ba80d9ed938af4a460 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:46:44 -0700 Subject: [PATCH 4/7] updating pipeline script --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index a9059567..2dd557ba 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -27,7 +27,7 @@ pipelines: - docker push $IMAGE_NAME feature/*: - step: - image: $IMAGE_NAME + image: ldooks/dragon-bot script: # Only build iamges, dont push when we're on a feature branch # build the Docker image (this will use the Dockerfile in the root of the repo) From 28c8eaf623a2ac74924af1ea3c46d3d8f542252f Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:47:38 -0700 Subject: [PATCH 5/7] updating pipeline script --- bitbucket-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 2dd557ba..90bfac50 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -27,7 +27,6 @@ pipelines: - docker push $IMAGE_NAME feature/*: - step: - image: ldooks/dragon-bot script: # Only build iamges, dont push when we're on a feature branch # build the Docker image (this will use the Dockerfile in the root of the repo) From e5013f632b7f3017a8ffbc4cc8e072b606fb8035 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:49:50 -0700 Subject: [PATCH 6/7] updating pipeline script --- bitbucket-pipelines.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 90bfac50..48a71b2b 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -10,15 +10,11 @@ options: docker: true pipelines: - default: - - step: - script: - # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings - - export IMAGE_NAME=ldooks/dragon-bot:latest branches: master: - step: script: + - export IMAGE_NAME=ldooks/dragon-bot:latest # build the Docker image (this will use the Dockerfile in the root of the repo) - docker build -t $IMAGE_NAME . # authenticate with the Docker Hub registry From e4cc526beae699e5bb97bf371b7cd2d0e4d435ea Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:49:58 -0700 Subject: [PATCH 7/7] updating pipeline script --- bitbucket-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 48a71b2b..3fa6710f 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -25,5 +25,6 @@ pipelines: - step: script: # Only build iamges, dont push when we're on a feature branch + - export IMAGE_NAME=ldooks/dragon-bot:latest # build the Docker image (this will use the Dockerfile in the root of the repo) - docker build -t $IMAGE_NAME . \ No newline at end of file