1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-06-07 13:49:54 +00:00

feat: Add a prebuilt docker image (#448)
Some checks failed
Build Docker image / build (push) Failing after 42s

This commit is contained in:
Florian Bouillon 2023-11-29 11:20:11 +01:00 committed by GitHub
parent 3c93a3534c
commit 2da15ced34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,58 +1,51 @@
name: Build name: Build Docker image
# 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: on:
push: push:
branches: [ master ] branches:
# Publish semver tags as releases. - '*'
tags: [ 'v*.*.*' ] tags:
- v*
pull_request: pull_request:
branches: [ master ] branches:
- master
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: tcgdex/server
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
# Login against a Docker registry except on PR - name: Docker meta
# https://github.com/docker/login-action id: meta
- name: Log into registry ${{ env.REGISTRY }} uses: docker/metadata-action@v5
if: github.event_name != 'pull_request' with:
uses: docker/login-action@v1 images: ghcr.io/tcgdex/server
with: tags: |
registry: ${{ env.REGISTRY }} type=edge
username: ${{ github.actor }} type=ref,event=pr
password: ${{ secrets.GITHUB_TOKEN }} type=ref,event=branch,prefix=branch-
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern=latest
# Extract metadata (tags, labels) for Docker - name: Login to Docker Hub
# https://github.com/docker/metadata-action uses: docker/login-action@v3
- name: Extract Docker metadata with:
id: meta registry: ghcr.io
uses: docker/metadata-action@v3 username: ${{ github.actor }}
with: password: ${{ secrets.DOCKER_TOKEN }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR) - name: Set up Docker Buildx
# https://github.com/docker/build-push-action uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v3 - name: Build and push
with: uses: docker/build-push-action@v5
context: . with:
push: ${{ github.event_name != 'pull_request' }} context: .
tags: ${{ steps.meta.outputs.tags }} push: true
labels: ${{ steps.meta.outputs.labels }} file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}