Closed headyj closed 10 months ago
If you look at the bottom of the Git context section, we explain how to provide a subdir for the default Git context:
Default Git context can also be provided using the Handlebars template expression
{{defaultContext}}
. Here we can use it to provide a subdirectory to the default Git context:- # Setting up Docker Buildx with docker-container driver is required # at the moment to be able to use a subdirectory with Git context name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build and push uses: docker/build-push-action@v4 with: context: "{{defaultContext}}:mysubdir" push: true tags: user/app:latest
In your case:
- name: Build and push
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:docker"
push: true
tags: registry/image:latest
file: docker/Dockerfile
Hello,
in the documentation, it's written the following:
This seems not true, as I if I don't do an action/checkout before my docker build, sources are not even found:
buildx failed with: ERROR: could not find docker: stat docker: no such file or directory
my Dockerfile is in fact in a subfolder named "docker" on my git repo. The dockerfile will only be found if I do an action/checkout before my build-push-action:
moreover, if I don't setup the context, git sources are not found at all