Skip to content

GitHub Actions to allow the building of Docker containers using the TNA base Docker images

Notifications You must be signed in to change notification settings

nationalarchives/ds-docker-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

Docker build GitHub actions

Build, lint and maintain Docker images with consistent labelling.

Used by:

Build a Docker image

name: Build Docker image

on:
  push:

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
    steps:
      - uses: actions/checkout@v4
      - name: Build Docker image
        uses: nationalarchives/ds-docker-actions/.github/actions/docker-build@main
        with:
          version: 0.1.0
          latest: false
          github-token: ${{ secrets.GITHUB_TOKEN }}
          docker-image-name: my-application

Build a Docker image with a generated version number

name: Build Docker image

on:
  push:

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
    steps:
      - uses: actions/checkout@v4
      - name: Create version tag
        id: version-tag
        uses: nationalarchives/ds-docker-actions/.github/actions/get-version-tag@main
      - name: Build Docker image
        uses: nationalarchives/ds-docker-actions/.github/actions/docker-build@main
        with:
          version: ${{ steps.version-tag.outputs.version-tag }}
          latest: ${{ github.ref == 'refs/heads/main' }}
          github-token: ${{ secrets.GITHUB_TOKEN }}
          docker-image-name: my-application

Remove untagged Docker images

name: Remove untagged Docker images

on:
  workflow_dispatch:
  schedule:
    - cron: "0 3 * * 1"  # 03:00 every Monday

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
    steps:
      - name: Remove untagged Docker images
        uses: nationalarchives/ds-docker-actions/.github/actions/remove-untagged@main
        with:
          docker-image-name: my-application
          github-token: ${{ secrets.GITHUB_TOKEN }}

About

GitHub Actions to allow the building of Docker containers using the TNA base Docker images

Resources

Stars

Watchers

Forks