cicd
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
name: Deploy Template
|
name: Deploy Template
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
runner:
|
runner:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
image:
|
image:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ${{ inputs.runner }}
|
runs-on: ${{ inputs.runner }}
|
||||||
@@ -33,4 +33,4 @@ jobs:
|
|||||||
DOCKER_IMAGE: ${{ inputs.image }}
|
DOCKER_IMAGE: ${{ inputs.image }}
|
||||||
run: |
|
run: |
|
||||||
docker compose up -d --pull always --remove-orphans
|
docker compose up -d --pull always --remove-orphans
|
||||||
|
|
||||||
61
.gitea/workflows/docker-build-push.yml
Normal file
61
.gitea/workflows/docker-build-push.yml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
name: Docker Build & Push (Template)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
runner:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ubuntu-latest
|
||||||
|
image_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
image_tag:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: latest
|
||||||
|
dockerfile:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: Dockerfile
|
||||||
|
context:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: .
|
||||||
|
outputs:
|
||||||
|
image:
|
||||||
|
description: Fully-qualified image reference pushed to Docker Hub
|
||||||
|
value: ${{ jobs.build.outputs.image }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ${{ inputs.runner }}
|
||||||
|
outputs:
|
||||||
|
image: ${{ steps.push.outputs.image }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-t "${{ inputs.image_name }}:${{ inputs.image_tag }}" \
|
||||||
|
-f "${{ inputs.dockerfile }}" \
|
||||||
|
"${{ inputs.context }}"
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ env.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ env.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Push Docker image to Docker Hub
|
||||||
|
id: push
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
REMOTE_IMAGE="${{ env.DOCKER_HUB_USERNAME }}/${{ inputs.image_name }}:${{ inputs.image_tag }}"
|
||||||
|
docker tag "${{ inputs.image_name }}:${{ inputs.image_tag }}" "$REMOTE_IMAGE"
|
||||||
|
docker push "$REMOTE_IMAGE"
|
||||||
|
echo "image=$REMOTE_IMAGE" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
Reference in New Issue
Block a user