Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Tiny-URL-CD-Pipeline

on:
workflow_run:
workflows: ["Tiny-URL-CI-Pipeline"] # must match `name:` in ci.yml
workflows: ["Tiny-URL-CI-Pipeline"]
types:
- completed
workflow_dispatch:
workflow_dispatch: {}

jobs:
build-docker-images:
#if: >
# github.event.workflow_run.conclusion == 'success' &&
#github.event.workflow_run.head_branch == 'main'
if: >
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main'
runs-on: ubuntu-latest

steps:
Expand All @@ -20,6 +20,14 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
buildkitd-flags: --debug

- name: Create and use a named Buildx builder
run: |
docker buildx create --use --name mybuilder || docker buildx use mybuilder
docker buildx inspect --bootstrap

- name: Cache Docker layers
uses: actions/cache@v3
Expand All @@ -31,18 +39,22 @@ jobs:

- name: Build API Docker image
run: |
docker build \
docker buildx build \
--builder mybuilder \
--file api/Dockerfile \
--tag your-org/tinyurl-api:main \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
--load \
./api

- name: Build Webapp Docker image
run: |
docker build \
docker buildx build \
--builder mybuilder \
--file webapp/Dockerfile \
--tag your-org/tinyurl-webapp:main \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
./webapp
--load \
./webapp
Loading