Skip to content

build artifacts for deployment via docker #1

build artifacts for deployment via docker

build artifacts for deployment via docker #1

Workflow file for this run

name: Docker CD
on:
push:
branches:
- main
tags:
- '*'
paths-ignore:
- '**.md'
jobs:
build:
# target older version so static bins run better on older Linuxes (debian:10, etc)
runs-on: ubuntu-20.04
steps:
- name: checkout code
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}${{ env.TAG }}
tags: |
type=raw,value=1.0.${{ github.run_number }},priority=1000
type=ref,event=branch
type=sha
type=raw,value=latest
- name: Log in to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- if: startsWith(github.ref, 'refs/heads/main')
run: echo "TAG=latest" >> $GITHUB_ENV
- if: startsWith(github.ref, 'refs/tags')
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV
- name: Build & Push
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}