Skip to content

Commit 0af5208

Browse files
authored
fix cd pipeline
1 parent efc13e0 commit 0af5208

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

.github/workflows/cd.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ name: Tiny-URL-CD-Pipeline
22

33
on:
44
workflow_run:
5-
workflows: ["Tiny-URL-CI-Pipeline"] # must match `name:` in ci.yml
5+
workflows: ["Tiny-URL-CI-Pipeline"]
66
types:
77
- completed
8-
workflow_dispatch:
8+
workflow_dispatch: {}
99

1010
jobs:
1111
build-docker-images:
12-
#if: >
13-
# github.event.workflow_run.conclusion == 'success' &&
14-
#github.event.workflow_run.head_branch == 'main'
12+
if: >
13+
github.event.workflow_run.conclusion == 'success' &&
14+
github.event.workflow_run.head_branch == 'main'
1515
runs-on: ubuntu-latest
1616

1717
steps:
@@ -20,6 +20,14 @@ jobs:
2020

2121
- name: Set up Docker Buildx
2222
uses: docker/setup-buildx-action@v3
23+
with:
24+
driver: docker-container
25+
buildkitd-flags: --debug
26+
27+
- name: Create and use a named Buildx builder
28+
run: |
29+
docker buildx create --use --name mybuilder || docker buildx use mybuilder
30+
docker buildx inspect --bootstrap
2331
2432
- name: Cache Docker layers
2533
uses: actions/cache@v3
@@ -31,18 +39,22 @@ jobs:
3139
3240
- name: Build API Docker image
3341
run: |
34-
docker build \
42+
docker buildx build \
43+
--builder mybuilder \
3544
--file api/Dockerfile \
3645
--tag your-org/tinyurl-api:main \
3746
--cache-from=type=local,src=/tmp/.buildx-cache \
3847
--cache-to=type=local,dest=/tmp/.buildx-cache \
48+
--load \
3949
./api
4050
4151
- name: Build Webapp Docker image
4252
run: |
43-
docker build \
53+
docker buildx build \
54+
--builder mybuilder \
4455
--file webapp/Dockerfile \
4556
--tag your-org/tinyurl-webapp:main \
4657
--cache-from=type=local,src=/tmp/.buildx-cache \
4758
--cache-to=type=local,dest=/tmp/.buildx-cache \
48-
./webapp
59+
--load \
60+
./webapp

0 commit comments

Comments
 (0)