Skip to content

chore: merge changes (#236) #6

chore: merge changes (#236)

chore: merge changes (#236) #6

name: Build Docker Image
on:
workflow_dispatch:
push:
branches:
- main
- production
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
production-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }} # ghcr.io
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.BRANCH_NAME }}
tags: |
type=raw,value=latest,enable=true
# mark all as latest
# ghcr.io/battlefield-portal-community/bfportal.gg/production:latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and Push Image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
file: './docker/dockerfile'