Closed BeyondEvil closed 2 years ago
You're specifying a path context string (./app
) which overrides the described automagic.
It looks like you want to specify a subdir on your build. You can still have most of the automagic by specifying the context as a full git repo URL in the way described by the docker build docs' description of Git Repo URLs. You'd use one with a trailing :app
. Something like:
context: https://github.com/proxyco/madmax-api.git#${{ env.GITHUB_REF }}:app
To make it a bit more reusable you can do something like:
jobs:
buildo:
runs-on: ubuntu-latest
env:
CONTEXT_SUBDIR: app
steps:
- name: Login to ECR
uses: docker/login-action@v1
with:
# your ecr details here
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push container
uses: docker/build-push-action@v2
with:
context: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}:${{ env.CONTEXT_SUBDIR }}"
push: true
tags: ${{ env.ECR_REGISTRY }}/proxyco/madmax-api:stable
There is a related feature request in: https://github.com/docker/build-push-action/issues/460
Thanks for the response @actualben !
Also, thanks for the suggested workaround, although not pretty, haha. :)
I might take a stab at that feature request, if you'll allow me?
There is a related feature request in: #460
I went ahead and added a PR. Hope you approve! 😊
👍 I was working on a PR myself but you were much quicker! I've submitted mine as a friendly alternative.
Behaviour
Expected behaviour
According to README:
Actual behaviour
Checkout doesn't happen.
Configuration
This
fails with error:
I have to explicitly do a checkout first, for the build to be successful.
It's a private repo.
This is run on a self-hosted runner using ubuntu-latest.
What am I doing wrong?