Multi-User-Domain / mud-jena

0 stars 0 forks source link

Add build workflow to GitHub Actions #8

Closed MattTennison closed 3 years ago

MattTennison commented 3 years ago

What?

CI to build and push our Docker image to DockerHub when a new push is done

The images will go to a new org I setup: https://hub.docker.com/repository/docker/multiuserdomain/mud-jena

Note: we need to add some secrets to this GitHub repo for this, I don't seem to have access rights - https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository

~@calummackervoy can I be admin pls? Or I can send over details to you and you can add them 😄 ~

I've setup a multiuserdomain org on DockerHub (essentially a group of users, and all our image tags will be prefixed with multiuserdomain). The free plan lets us have 3 members - I've added two (me and a CI user, so random builds aren't attributed to me - it's email goes to me at the moment, but when we get a domain we could look at changing that).

https://hub.docker.com/orgs/multiuserdomain

https://hub.docker.com/repository/docker/multiuserdomain/mud-jena

I'd like to get this merged fairly soon, because then we can Dockerise the other apps and setup a docker-compose file per app that could spin up master branch of all its dependencies, and a local dev environment (so say you wanted to just change mud-react, you could do docker-compose up there and bring up mud-jena master automagically for you, ports bound and everything).

Why?

Makes it easier to try out other people's work (just pull & run their Docker image). Could also become a PR check, to stop us merging code that doesn't build.

For example, on this branch if you want to run mud-jena locally:

docker run -p 8080:8080 multiuserdomain/mud-jena:ci-build-step
calummackervoy commented 3 years ago

OK you're admin 👍

Makes it easier to try out other people's work (just pull & run their Docker image)

so literally just like this?

git checkout <branch>
git pull
docker run -p 8080:8080 mud-jena:<branch>
MattTennison commented 3 years ago

OK you're admin +1

Makes it easier to try out other people's work (just pull & run their Docker image)

so literally just like this?

git checkout <branch>
git pull
docker run -p 8080:8080 mud-jena:<branch>

Yeah basically. Because the image has been built and pushed to a public place by GitHub, you wouldn't even need to checkout the branch, just run the image.

I think the tag name might be slightly more complex, but when I figure that out I'll put it in the README :smile:

EDIT: the tag is a bit faffier, as it needs to include the org as well (to allow many mud-jena's to coexist happily ever after)

docker run -p 8080:8080 multiuserdomain/mud-jena:ci-build-step
calummackervoy commented 3 years ago

Ah that's really nice thanks! Makes it so easy to debug different branches and to deploy code :D I think it's fine that the tag's a little bit longer :)

calummackervoy commented 3 years ago

Is it ready to merge ? I'll add this command to the README ?

MattTennison commented 3 years ago

Is it ready to merge ? I'll add this command to the README ?

Yeah, I've just put a bit in about it :) - https://github.com/Multi-User-Domain/mud-jena/pull/8/commits/be4f0fecfe527add87509769c6eae115fa8e56dd

I think it's ready for merging now