-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tries to pull the image when image is available locally #425
Comments
To solve that you can use a local registry in your workflow.
Why? If you can pull with From what I see you could use the following workflow: ARG BASE_IMAGE=test/base-node
FROM ${BASE_IMAGE}
COPY package.json /app/sdadministrator/package.json build-test:
needs: build-base-node
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-single-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-single-buildx
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build Base Node
uses: docker/build-push-action@v2
with:
context: src/microservices/sdgateway
builder: ${{ steps.buildx.outputs.name }}
file: ./src/microservices/sdgateway/Dockerfile
build-args: |
BASE_IMAGE=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_BASE_IMAGE }}:$IMAGE_TAG
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_APP_REPOSITORY }}:${{needs.build-base-node.outputs.BRANCH_TAG}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new PS:
|
@crazy-max By this way, it is building the docker image without caching. |
@genieai-vikas Don't see how it would be different than your initial workflow. Do you have a link to your repo? |
@crazy-max Actually, It's a private repo but here is the logs(I changed some of the sensitive info). This logs is of the 2nd run so if you see the logs instead of done it supposed to have cached.
|
@genieai-vikas Maybe you should cache all stages with cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max Hard to tell without your Dockerfile. Also if your base image |
Why doesn't this work with |
Behaviour
Steps to reproduce this issue
Error: buildx failed with: error: failed to solve: test/base-node: pull access denied, repository does not exist or may require authorization: authorization status: 401: authorization failed
Expected behaviour
Actual behaviour
P.S In the dockerfile I can't have a full ECR registry something like this
The text was updated successfully, but these errors were encountered: