heroku-deploy icon indicating copy to clipboard operation
heroku-deploy copied to clipboard

add targer to docker build

Open eerison opened this issue 3 years ago • 5 comments

Should be possible to add --target when we going to do docker build

for example ...

I have an Dockerfile with

FROM image as base

FROM image as dev

eerison avatar Feb 12 '21 18:02 eerison

Hey @eerison, sorry about asking you regarding this so late. But could elaborate a bit more?

AkhileshNS avatar Feb 23 '21 10:02 AkhileshNS

Hi @AkhileshNS

I'm deploying using docker and it's my Dockerfile

FROM php:7.4-fpm as base

RUN apt-get update
 ....

FROM base as heroku_web

//build steps ....

FROM base as dev

//dev steps ...

when I run the pipeline to build the image to send to heroku, I would like to use heroku_web only, But for now there isn't an option to choose the --target, and it's getting all Dockerfile incluing dev steps.

eerison avatar Feb 26 '21 09:02 eerison

Same here, I would like to have the option to specify the --target argument for the Docker build. This is necessary to take advantage of Docker multi-stage builds. @AkhileshNS to my knowledge this is not possible to do currently, do you know if this is on the roadmap?

mzanini avatar Aug 15 '21 00:08 mzanini

Hey @mzanini, Yes it is in the roadmap to add this. I haven't really been able to work on the action for the past nearly 6 months since Covid-19 and having had to make arrangements to move to another country but I do intend to have this feature added by the end of the month. Also I may look into finding people to help maintain the action so sudden stubs of inactivity like this one won't happen again

AkhileshNS avatar Aug 15 '21 01:08 AkhileshNS

Thanks @AkhileshNS !

EDIT: I did some more research and it looks like it is not possible to specify a target as a command-line option to heroku container:push, which is the tool used by this GitHub action.

As an alternative, one can use heroku.yml to specify more complex build arguments

mzanini avatar Aug 16 '21 13:08 mzanini