init
This commit is contained in:
commit
2383c311ce
3 changed files with 90 additions and 0 deletions
88
.gitea/workflows/build_container.yml
Normal file
88
.gitea/workflows/build_container.yml
Normal file
|
@ -0,0 +1,88 @@
|
|||
name: build container
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
registry:
|
||||
required: true
|
||||
type: string
|
||||
description: "registry to upload the container to"
|
||||
image-name:
|
||||
required: true
|
||||
type: string
|
||||
description: "image name of the container"
|
||||
context:
|
||||
required: false
|
||||
type: string
|
||||
description: "context location for the build"
|
||||
default: "."
|
||||
dockerfile:
|
||||
required: false
|
||||
type: string
|
||||
description: "location of the dockerfile"
|
||||
default: "Dockerfile"
|
||||
platforms:
|
||||
required: false
|
||||
type: string
|
||||
description: "platforms to build for"
|
||||
default: "linux/amd64"
|
||||
|
||||
secrets:
|
||||
cr-username:
|
||||
required: true
|
||||
description: "registry username"
|
||||
cr-password:
|
||||
required: true
|
||||
description: "registry password"
|
||||
|
||||
jobs:
|
||||
build-container:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup qemu
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: setup docker buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: get container metadata
|
||||
uses: docker/metadata-action@v4
|
||||
id: metadata
|
||||
with:
|
||||
images: ${{ inputs.registry }}/${{ inputs.image-name }}
|
||||
flavor: |
|
||||
latest=auto
|
||||
prefix=
|
||||
suffix=
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
- name: login to container registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ inputs.registry }}
|
||||
username: ${{ secrets.cr-username }}
|
||||
password: ${{ secrets.cr-password }}
|
||||
|
||||
- name: build and push docker image @${{ inputs.platforms }}
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: ${{ gitea.event_name != 'pull_request' }}
|
||||
platforms: ${{ inputs.platforms }}
|
||||
context: ${{ inputs.context }}
|
||||
file: ${{ inputs.dockerfile }}
|
||||
provenance: false
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
build-args: |
|
||||
BUILD_VERSION=${{ steps.metadata.outputs.version }}
|
||||
BUILD_COMMIT=${{ gitea.sha }}
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
.vscode/
|
0
README.md
Normal file
0
README.md
Normal file
Reference in a new issue