fasten-onprem/.github/workflows/build.yaml

70 lines
2.2 KiB
YAML
Raw Normal View History

2022-09-27 08:47:50 -06:00
name: Docker
on:
push:
branches: [ main, sandbox ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
2022-09-27 08:53:00 -06:00
docker:
2022-09-27 08:47:50 -06:00
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
# - name: "Populate frontend version information"
# run: "cd webapp/frontend && ./git.version.sh"
# - name: "Generate frontend & version information"
# uses: addnab/docker-run-action@v3
# with:
# image: node:lts
# options: -v ${{ github.workspace }}:/work
# run: |
# cd /work
# make binary-frontend && echo "print contents of /work/dist" && ls -alt /work/dist
2022-09-27 09:44:12 -06:00
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# with:
# platforms: 'arm64,arm'
2022-09-27 08:47:50 -06:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
tags: |
type=ref,enable=true,event=branch
type=ref,enable=true,event=tag
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
2022-09-27 09:44:12 -06:00
# platforms: linux/amd64,linux/arm64
2022-09-27 08:47:50 -06:00
context: .
2022-09-27 08:53:00 -06:00
file: Dockerfile
2022-09-27 08:47:50 -06:00
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max