docker: add new build-image step on github ci
This commit is contained in:
parent
700f9325a3
commit
9b5158dec2
|
|
@ -9,6 +9,12 @@ on:
|
|||
branches:
|
||||
- develop
|
||||
- main
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_only:
|
||||
description: 'Build Docker image only (skip deploy)'
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
|
|
@ -149,6 +155,46 @@ jobs:
|
|||
- name: Frontend Tests
|
||||
run: bun run test
|
||||
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [tests, linter]
|
||||
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'workflow_dispatch'
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=sha,prefix=
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [tests, linter]
|
||||
|
|
|
|||
Loading…
Reference in New Issue