Skip to content

Commit

Permalink
Reintroduce base image monitoring and updating
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceMcCarthy committed May 23, 2024
1 parent 93e0156 commit 9e0de12
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 35 deletions.
43 changes: 8 additions & 35 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,18 @@ on:
- 'DevCraftAspire.Web/**/*'
- '.github/workflows/deploy.yml'

env:
CONTAINER_REGISTRY: "ghcr.io"
BASE_IMAGE: "ghcr.io/lancemccarthy/aspirebase:8.0"
APISERVICE_CONTAINER_REPO: "lancemccarthy/aspireapiservice"
APISERVICE_CONTAINER_TAG: "8.0"

permissions:
id-token: write
contents: read
packages: write

jobs:
update_base_image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{env.CONTAINER_REGISTRY}}
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

# Build a custom base image with needed Linux dependencies preinstalled
- name: Build Custom Image and push to GitHub packages
working-directory: '.dockerbuilds/baseimage'
id: build-and-publish
run: |
docker build -t "${{env.BASE_IMAGE}}" -f Dockerfile .
docker push "${{env.BASE_IMAGE}}"
deploy_app:
needs: [update_base_image]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
env:
CONTAINER_REGISTRY: "ghcr.io"
BASE_IMAGE: "ghcr.io/lancemccarthy/aspirebase:8.0"
APISERVICE_CONTAINER_REPO: "lancemccarthy/aspireapiservice"
APISERVICE_CONTAINER_TAG: "8.0"
ASPIRE_ENVIRONMENT: "aspire2b"
AZURE_CLIENT_ID: ${{vars.AZURE_CLIENT_ID}}
AZURE_TENANT_ID: ${{vars.AZURE_TENANT_ID}}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/monitor-base-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Monitor .NET Base Images"
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # Check once a week on Sunday, at midnight

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # required to trigger repository_dispatch
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: mthalman/docker-bump-action@v0
with:
base-image-name: 'mcr.microsoft.com/dotnet/aspnet:8.0'
target-image-name: 'ghcr.io/lancemccarthy/aspirebase:8.0'
43 changes: 43 additions & 0 deletions .github/workflows/update-base-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Update Custom Base Images"
on:
workflow_dispatch:
repository_dispatch:
types: [base-image-update]

env:
CONTAINER_REGISTRY: "ghcr.io"
BASE_IMAGE: "ghcr.io/lancemccarthy/aspirebase:8.0"
APP_IMAGE_NAME: lancemccarthy/aspireapiservice
APP_IMAGE_TAG: "8.0"

permissions:
id-token: write
contents: read
packages: write

jobs:
ghcr_custom_image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{env.CONTAINER_REGISTRY}}
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

# Build a custom base image with needed Linux dependencies preinstalled
- name: Build Custom Image and push to GitHub packages
working-directory: '.dockerbuilds/baseimage'
id: build-and-publish
run: |
docker build -t "${{env.BASE_IMAGE}}" -f Dockerfile .
docker push "${{env.BASE_IMAGE}}"

0 comments on commit 9e0de12

Please sign in to comment.