Skip to content

Docker Build

Docker Build #181

Workflow file for this run

name: Docker Build
concurrency: docker
on:
push:
branches:
- develop
paths:
- Dockerfile
- scripts/entrypoint.sh
workflow_run:
workflows: ["CI"]
branches: [develop]
types:
- completed
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Get Previous tag"
id: previoustag
uses: actions-ecosystem/action-get-latest-tag@v1
with:
semver_only: true
initial_version: v0.0.0
with_initial_version: true
- name: Get current date
id: getbuilddate
run: |
echo "::set-output name=date::$(date -u)"
echo "::set-output name=isodate::$(date -u '+%Y-%m-%dT%H:%M:%S')"
echo "::set-output name=tagdate::$(date -u '+%Y%m%d%H%M%S')"
echo "::set-output name=timestamp::$(date -u '+%s')"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/sweetrpg/catalog-api
tags: |
type=raw,value=latest
type=raw,value=${{ steps.previoustag.outputs.tag }}
type=raw,value=${{ steps.getbuilddate.outputs.tagdate }}
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
# context: .
push: true
no-cache: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
BUILD_NUMBER=${{ github.run_number }}
BUILD_JOB=${{ github.job }}
BUILD_SHA=${{ github.sha }}
BUILD_DATE=${{ steps.getbuilddate.outputs.isodate }}
BUILD_VERSION=${{ steps.previoustag.outputs.tag }}
# tags: registry.sweetrpg.com/sweetrpg-catalog-api:latest
# - name: Scan image
# uses: sysdiglabs/scan-action@v1
# with:
# image-tag: registry.sweetrpg.com/sweetrpg-catalog-api:latest
# sysdig-secure-token: ${{ secrets.SYSDIG_SECURE_TOKEN }}
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
environment: ${{ vars.SENTRY_ENV }}