Category Archives: Web Development

Posts related to programming, development docker, php etc

Learning how to use Github Actions

I have spent the last few hours playing with Github actions. I had a need to scratch. Docker stopped the automated builds of my docker images for which I use within bitbucket pipelines.

Any time I used to commit to my git Bitbucket repo for the pipelines image a webhook would trigger this to build on Docker. Now however unless you fork out money to Docker this no longer works.

I could have worked out how to automate the process locally to build the image and push to docker hub but I wanted a more automated way. So I looked into Github Actions.

I also had another issue I wanted to solve. I need to maintain both a PHP 7.4 version for legacy apps and PHP 8.0 for newer apps. At the time I was only running the one version, PHP 7.4. After looking at what some of the other packages and services I use it seems most use a Docker file for the two versions. So I did that. Renamed my original and saved another with a couple of alterations.

I use Ansible to build the image anyway. So all I need to do is refactor a couple of variables to a new file and then call two different playbook. The two playbooks would then get called by the two different Dockerfiles.

Next step was to work our how Github Actions worked. After a bit of Googling and a few blog posts it seemed pretty straight forward. So a little tweaking and dummy commits I had two images being built and then pushed to Docker hub with different tags. This was already much better than I had in place already.

One last action I run from another server is to check for new Google Chrome releases and call a webhook to build the image again. This too took less than an hour to sort out and test.

Resources

Both the repository to build the image and the images are public. See the links below.

Github repository that builds the images https://github.com/lionslair/rzepecki-laravel-php

Docker Hub repo https://hub.docker.com/r/lionslair/rzepecki-laravel-php/tags?page=1&ordering=last_updated