Add nextjs-build.yml
This commit is contained in:
56
nextjs-build.yml
Normal file
56
nextjs-build.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
working_dir:
|
||||
required: false
|
||||
type: string
|
||||
default: '.'
|
||||
image_name:
|
||||
required: true
|
||||
type: string
|
||||
registry:
|
||||
required: false
|
||||
type: string
|
||||
default: 'git.moujtahid.com'
|
||||
secrets:
|
||||
REGISTRY_USER:
|
||||
required: true
|
||||
REGISTRY_PASSWORD:
|
||||
required: true
|
||||
|
||||
env:
|
||||
REGISTRY: git.moujtahid.com
|
||||
DOCKER_HOST: tcp://localhost:2375
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKER_HOST: tcp://localhost:2375
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver: docker
|
||||
driver-opts: |
|
||||
image=moby/buildkit:latest
|
||||
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ inputs.registry }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ${{ inputs.working_dir }}
|
||||
push: true
|
||||
tags: |
|
||||
${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:latest
|
||||
${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:${{ gitea.sha }}
|
||||
cache-from: type=registry,ref=${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:cache
|
||||
cache-to: type=registry,ref=${{ inputs.registry }}/${{ gitea.repository }}/${{ inputs.image_name }}:cache,mode=max
|
||||
Reference in New Issue
Block a user