Off topic, again

lilo-coffee-roasters
Lilo Coffee Roasters is good, but not as shockingly great as Glitch.
Coffee bean is a OK for me, bit too light roasted for me.
May be just for the beans next time.

Back to the topic

Recently I built a small project and I want to run the code inside Docker container.

I am going to host this Docker container inside my homelab, but too lazy to do the manual docker build and docker run each time I change something.

So again, Komodo comes to the rescue

It takes your code and Dockerfile, and build the Docker image for you.
And deploy that for you, all in one git push, no additional Github action.

Add builder in Komodo to build image

  1. Go to Resources > Builders
  2. Click New Builder, set name of your builder and builder Type = Server komodo-add-builder
  3. Pick the server you want to build your Docker image at
    komodo-builder-server

Add a build profile in Komodo, which automates the build

  1. Go to Resources > Builds
  2. Fill in the necessary information
    • Builder
    • Version (You can set initial version and auto-increment the version per git push)
    • Source, account and repo
    • Image Registry (you can push to custom Image Registry like Dockerhub, Nexus…)
  3. The deployment will find the Dockerfile in the root of the git repo
    • If you want to change that, change the Dockerfile path
  • komodo-build-version

Yes, your instinct are right. The automation is done by Webhook. Again.

  1. Just like the automatic stack deployment, enable the webhook function
  2. Set the secret and copy the url, secret to Gitea project
  • komodo-build-webhook

Then you have an auto-build Docker Image action when you push your changes to git repo.

Final touch, the auto deployment after build

  1. Go to Resources > Deployments
  2. Fill in the necessary information
    • Server (that host the docker container, if your build destination is local, please make sure you run on the same machine)
    • Build (Select “Build” on the first dropdown, and the build name you have just created last step)
    • Turn on “Redeploy on build” to automatically deploy after the build is complete
    • Network Mode
  • komodo-add-deployment

After setting these items, you can test your stuff by pushing changes to git repo
And see the container is automatically re-deployed.
komodo-auto-deployment

Maybe I want a centralized private Docker registry just because it is more convenient to build and deploy in different machine.