Docker #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '16 6 * * *' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ vars.IMAGE_NAME }} | |
tags: | | |
type=schedule | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
env: | |
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index | |
- name: Build and export to Docker | |
uses: docker/build-push-action@v6 | |
with: | |
load: true | |
push: true | |
tags: ${{ vars.IMAGE_NAME }}:test | |
- name: Test | |
run: | | |
docker run --detach --rm --network=host -e ACCESS_KEY_ID=${{ secrets.ACCESS_KEY_ID }} -e SECRET_ACCESS_KEY=${{ secrets.SECRET_ACCESS_KEY }} ${{ vars.IMAGE_NAME }}:test | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
tags: ${{ steps.meta.outputs.tags }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
push: true |