How to make simple docker Continues delivery for small projects.

Sample app: Update my static website

This tutorial assumes:

1) you have your project as a hosted docker container
2) you have docker-compose.yml in your project's repo on github
3) you have docker /docker-compose installed
4) you have a git repo with the source code
5) your docker hub account is linked to github

Setup auto builds on docker hub

Link to github
select the repo you're docker container project is
download your project

modify the docker-compose file

ADD

version: '3.3'
services:
<--snip--->
        labels: 
            com.centurylinklabs.watchtower.enable: true
<--snip--->
        image: 'wisehackermonkey/website:latest'

Run your project with the modified  docker-compose file

Have Watchtower automatically update your app

Create a docker-compose file

EXAMPLE

version: "3"
services:
  watchtower:
    image: containrrr/watchtower
    environment:
      REPO_USER: <DOCKER HUB USERNAME>
      REPO_PASS: <DOCKER HUB PASSWORD>
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: --interval 1 --label-enable

in my case it looked like

version: "3"
services:
  watchtower:
    image: containrrr/watchtower
    environment:
      REPO_USER: wisehackermonkey
      REPO_PASS: XXXXXXXXX
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: --interval 1 --label-enable

NOTE: I am adding my docker hub account user/password because watchtower complains about its access it wants me to run 'docker login'

Run docker compose on watchtower docker-compose file

Look at logs to see if everything worked

"Ctrl + c" to exit

Test our ghetto CD pipeline!

Make a change on github

In my case

Create a Tag for docker hub to build

Docker hub registered a build and it completed

Notice that the app has now been updated witht the latest code from github through the build docker image!

Lets check the website to see if the "." showed up

SUCCESS!

by oran collins
github.com/wisehackermonkey
oranbusiness gmail com
20210208