deployer icon indicating copy to clipboard operation
deployer copied to clipboard

docker: build and push image

Open alexislefebvre opened this issue 2 years ago • 3 comments

  • [x] Bug fix #3118
  • [x] New feature?
  • [ ] BC breaks?
  • [ ] Docs added?

I target 6.x so that 6.x and 7.x (later) could have Docker releases.

I tested it in another project: I created a 0.0.3 tag here https://github.com/alexislefebvre/docker-images/tree/0.0.3 GitHub Actions built an image and pushed it there: https://github.com/alexislefebvre/docker-images/pkgs/container/php-8.1-jakzal-phpqa-gd

Once this will work, people will be able to run something like docker run ghcr.io/deployphp/deployer:v6.9.1 dep, use the image on their CI system, etc.

:warning: I don't know if it may allow a contributor to push bad code to a Docker image, sorry.

If you merge it and create a tag, it may fail if the registry is not active yet, IIRC we had the issue too and we had to change the visibility of our GitHub registry to private to public before we could push images.

To test the image: checkout this branch and run docker build:

docker build . --tag deployer --build-arg VERSION=v6.9.1
docker run deployer

Real test on my fork:

  1. workflow: https://github.com/alexislefebvre/deployer/actions/runs/4179168257/jobs/7238799360 (it will expire at some point)
  2. resulting image: https://github.com/alexislefebvre/deployer/pkgs/container/deployer
  3. it works!
$ docker run -t --rm ghcr.io/alexislefebvre/deployer:v6.9.3 help
Description:
  Display help for a command

Usage:
  help [options] [--] [<command_name>]

[…]

alexislefebvre avatar Feb 14 '23 23:02 alexislefebvre

Awesome cool. Will review and if not merge definitely take an inspiration from it)

antonmedv avatar Feb 15 '23 13:02 antonmedv

FYI, this will build multiarch images for different php/deployer version combinations:

  • https://github.com/ochorocho/deployer/blob/main/Dockerfile
  • https://github.com/ochorocho/deployer/blob/main/.github/workflows/build.yml

ochorocho avatar Aug 24 '23 22:08 ochorocho

@antonmedv Could you please check this PR?

@ochorocho Thanks for sharing it, I think we can merge this PR as is then add support of other architectures in another PR.

alexislefebvre avatar Apr 14 '24 16:04 alexislefebvre