docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.28k stars 548 forks source link

Action for Pushing without Building #882

Closed igorluppi closed 1 year ago

igorluppi commented 1 year ago

I feel like it takes to long to build-and-push while it uses Run docker/setup-buildx-action@v2 and the building step from Run docker/build-push-action@v2. If I locally build using docker build . --file Dockerfile --tag $IMAGE_NAME it takes no longer than a minute (using the docker default cache).

Or something it odd with the build cache step, because it takes a long time. I wanted the action to just push the image I already have build. Isnt possible?

crazy-max commented 1 year ago

I wanted the action to just push the image I already have build. Isnt possible?

No, but like https://github.com/docker/build-push-action/issues/538 you can just have a step pushing your image.

I feel like it takes to long to build-and-push while it uses Run docker/setup-buildx-action@v2 and the building step from Run docker/build-push-action@v2.

Do you have a repro?

If I locally build using docker build . --file Dockerfile --tag $IMAGE_NAME it takes no longer than a minute (using the docker default cache).

Maybe it's using cache from your local state and in your workflow you might not use any remote cache I guess.

igorluppi commented 1 year ago

What would be your suggestion @crazy-max ? I will wait until the first push finish and try again, I'm using gha cache.

But using the local build (without this action), it takes <1min (most steps have been skipped due docker cache). and pushing with another step (without this action) it takes more 3 minutes.

Which cache should I use to get a similar timing using the build-push-action? The local cache?

cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
crazy-max commented 1 year ago

Please post a full repro, I can't tell without it.

LeviPesin commented 1 year ago

No, but like https://github.com/docker/build-push-action/issues/538 you can just have a step pushing your image.

In this case you should tag your image yourself which is not very trivial... Wouldn't it be better if the action supported skipping build?

mrala commented 8 months ago

I'm not sure why this was closed as completed. Could this issue or #538 be reopened? It seems like the ability to push without building is a common use case.

LeviPesin commented 7 months ago

@crazy-max Is this possible, please?