Replies: 1 comment 5 replies
-
https://github.com/Satont/twir/actions/runs/6882663892/workflow#L62-L63 - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 You're using the What you can do is using a named context: https://docs.docker.com/build/ci/github-actions/named-contexts/#using-with-a-container-builder Would be smth like that in your case: backend:
runs-on: ubuntu-latest
needs:
- base
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
target:
- api
- bots
- discord
- emotes-cacher
- eval
- events
- eventsub
- integrations
- language-detector
- parser
- scheduler
- timers
- tokens
- websockets
- ytsr
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Restore base images
uses: actions/download-artifact@v3
with:
path: /tmp
- name: Load base images
run: |
docker load --input /tmp/builder/builder.tar &
docker load --input /tmp/node_prod_base/node_prod_base.tar &
docker load --input /tmp/go_prod_base/go_prod_base.tar &
wait
docker image ls
docker tag twir-base:builder localhost:5000/twir-base:builder
docker push localhost:5000/twir-base:builder
- name: Build ${{ matrix.target }}
uses: docker/build-push-action@v5
with:
context: .
build-contexts: |
builder=docker-image://localhost:5000/twir-base:builder
push: false
load: true
file: ./apps/${{ matrix.target }}/Dockerfile
tags: twir:${{ matrix.target }}
cache-from: type=gha,scope=twir:${{ matrix.target }}
cache-to: type=gha,mode=max,scope=twir:${{ matrix.target }} But I wonder why you do this and don't rely instead on GitHub Cache backend for your base images? You would not need to upload/download artifacts and just set - name: Build ${{ matrix.target }}
uses: docker/build-push-action@v5
with:
context: .
build-contexts: |
builder=docker-image://localhost:5000/twir-base:builder
push: false
load: true
file: ./apps/${{ matrix.target }}/Dockerfile
tags: twir:${{ matrix.target }}
cache-from: |
type=gha,scope=twir-base:builder
type=gha,scope=twir-base:node_prod_base
type=gha,scope=twir-base:go_prod_base
type=gha,scope=twir:${{ matrix.target }}
cache-to: type=gha,mode=max,scope=twir:${{ matrix.target }} |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to build base at one job, then transfer that image to other jobs.
But for some reason when building docker saying image not found after restore, even previous step
Load base images
showed that image as existed.Load:
Build:
Workflow file: https://github.com/Satont/twir/actions/runs/6882663892/workflow
Beta Was this translation helpful? Give feedback.
All reactions