mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: update workflows
* build images with automatic tags * separate staging and production deployment * reuse workflows
This commit is contained in:
1 parent
81581c4635
commit
7d25c7efaa
8 files changed
+197
-118
No files matched your search
@@ -0,0 +1,51 @@
|
||||
name: Build Docker Image
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
imageName:
|
||||
type: string
|
||||
required: true
|
||||
description: 'Name of the image to build'
|
||||
dockerfilePath:
|
||||
type: string
|
||||
required: true
|
||||
description: 'Path to the Dockerfile'
|
||||
target:
|
||||
type: string
|
||||
required: false
|
||||
description: 'Target to build'
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ inputs.imageName }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build Image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ${{ inputs.dockerfilePath }}
|
||||
target: ${{ inputs.target }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
Reference in new issue
Block a user