10up / wpsnapshots

(DEPRECATED) A project sharing tool for WordPress.
MIT License
215 stars 22 forks source link

GitHub actions to build and push a new docker image when a new release is published #72

Closed eugene-manuilov closed 3 years ago

eugene-manuilov commented 3 years ago

Description of the Change

This PR adds a new GitHub Actions file that builds and pushes a new docker image when a release is published. When it builds a docker image, it uses a tarball archive generated by GitHub and associated with the release. It also tags the new image with the release name and a major version. For example, when 2.1.0 release is published, it will create a new image with the following tags: latest, 2.1.0, and 2.

The docker image itself is different from one that is currently used by the 10up/wp-local-docker-images. Probably, it is worth asking a system engineer to check it and provide feedback.

To make GitHub actions work correctly, we need to add two variables to this repo secrets: DOCKERHUB_ACCESS_TOKEN DOCKERHUB_USERNAME. The first one should contain an access token generated in the docker hub, and the second one should contain a username used in the docker hub.

Checklist:

TheLastCicada commented 3 years ago

@eugene-manuilov This is super cool and I'm really happy we have this automatically running in Actions. I have just a few questions....

  1. Why did we get away from using the official Docker action for building and pushing images https://github.com/docker/build-push-action ? I see we had it in here in one of the earlier commits and I like the way it handles logins..... seems like it would be the most reliable solution going forward.

  2. Can you tell me more about the image we use that is different than in 10up/wp-local-docker-images? Why are we using a different image here? I'm not sure it needs to be standardized, but maybe it should - I agree that I'd like @dustinrue or Jason to take a look and see what they think.

eugene-manuilov commented 3 years ago

Hi @TheLastCicada

  1. Why did we get away from using the official Docker action for building and pushing images? I see we had it in here in one of the earlier commits and I like the way it handles logins..... seems like it would be the most reliable solution going forward.

I have never worked with the official docker actions before. Plus, I found it a little bit confusing when I tried it at the beginning. Now, I think I agree with you and will give it another try next week.

  1. Can you tell me more about the image we use that is different than in 10up/wp-local-docker-images? Why are we using a different image here?

The current 10up/wpsnapshots:latest image isn't functional. When I tried to use it in the wp-local-docker instead of the dev version, it failed. I tried to find out how we build the dev image unsuccessfully and decided to create a new one that would work. Fortunately, I figured out how the dev image was built and have created a new PR (#74) that updates the dockerfile to be almost identical to what we use for the dev tag now. The only differences there are how we install wpsnapshots and which additional information we display when a container runs.

eugene-manuilov commented 3 years ago

@TheLastCicada i have updated GitHub actions to use the official Docker actions for it. All works perfectly.