Skip to content

Build & Publish Docker image #74

Build & Publish Docker image

Build & Publish Docker image #74

Workflow file for this run

name: Build & Publish Docker image
on:
pull_request:
branches: [main]
paths:
- '**'
- '!example/**'
- '!*.md'
push:
branches: [main]
paths:
- '**'
- '!example/**'
- '!*.md'
release:
types:
- published
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: nhost/functions
tags: |
type=schedule
type=raw,value=latest,enable=${{ github.event_name == 'push' && endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and publish to Docker Hub
uses: docker/build-push-action@v2
timeout-minutes: 60
with:
# TODO: use cache https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: 18-${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: 18.Dockerfile
- name: Build and publish to Docker Hub
uses: docker/build-push-action@v2
timeout-minutes: 60
with:
# TODO: use cache https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: 20-${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: 20.Dockerfile