107 lines
2.8 KiB
YAML
107 lines
2.8 KiB
YAML
name: docker-build-push
|
|
description: Clone app repo, build Docker image, and push it to the private registry
|
|
|
|
inputs:
|
|
git_server_url:
|
|
description: Full Git server URL, for example https://git.example.com
|
|
required: true
|
|
|
|
git_repository:
|
|
description: Repository path, for example example/testapp
|
|
required: true
|
|
|
|
git_sha:
|
|
description: Commit SHA to check out
|
|
required: true
|
|
|
|
git_user:
|
|
description: Git username for cloning private repositories
|
|
required: true
|
|
|
|
git_token:
|
|
description: Git token for cloning private repositories
|
|
required: true
|
|
|
|
registry:
|
|
description: OCI registry host
|
|
required: false
|
|
default: zmeyka.exocortex.ru
|
|
|
|
registry_user:
|
|
description: Registry username
|
|
required: true
|
|
|
|
registry_token:
|
|
description: Registry token or password
|
|
required: true
|
|
|
|
image_name:
|
|
description: Image path inside registry, for example example/testapp
|
|
required: true
|
|
|
|
image_tag:
|
|
description: Image tag, for example latest
|
|
required: true
|
|
|
|
context:
|
|
description: Docker build context
|
|
required: false
|
|
default: .
|
|
|
|
dockerfile:
|
|
description: Dockerfile path
|
|
required: false
|
|
default: Dockerfile
|
|
|
|
remote_docker_ssh_host:
|
|
description: Remote Docker host to pull and run the image on
|
|
required: false
|
|
|
|
remote_docker_ssh_port:
|
|
description: SSH port on the remote Docker host
|
|
required: false
|
|
default: "22"
|
|
|
|
remote_docker_ssh_username:
|
|
description: Remote Docker host SSH user
|
|
required: false
|
|
|
|
remote_docker_ssh_key:
|
|
decription: Private SSH key to update the image on remote Docker host
|
|
required: false
|
|
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Build the image
|
|
shell: bash
|
|
run: ${{ gitea.action_path }}/build.sh
|
|
- name: Push to registry
|
|
shell: bash
|
|
run: ${{ gitea.action_path }}/push.sh
|
|
- name: Update remote Docker host
|
|
if: ${{ inputs.update_remote == 'true' }}
|
|
shell: bash
|
|
run: ${{ gitea.action_path }}/update.sh
|
|
|
|
env:
|
|
INPUT_GIT_SERVER_URL: ${{ inputs.git_server_url }}
|
|
INPUT_GIT_REPOSITORY: ${{ inputs.git_repository }}
|
|
INPUT_GIT_SHA: ${{ inputs.git_sha }}
|
|
INPUT_GIT_USER: ${{ inputs.git_user }}
|
|
INPUT_GIT_TOKEN: ${{ inputs.git_token }}
|
|
INPUT_REGISTRY: ${{ inputs.registry }}
|
|
INPUT_REGISTRY_USER: ${{ inputs.registry_user }}
|
|
INPUT_REGISTRY_TOKEN: ${{ inputs.registry_token }}
|
|
INPUT_IMAGE_NAME: ${{ inputs.image_name }}
|
|
INPUT_IMAGE_TAG: ${{ inputs.image_tag }}
|
|
INPUT_CONTEXT: ${{ inputs.context }}
|
|
INPUT_DOCKERFILE: ${{ inputs.dockerfile }}
|
|
INPUT_REMOTE_DOCKER_SSH_HOST: ${{ inputs.remote_docker_ssh_host }}
|
|
INPUT_REMOTE_DOCKER_SSH_PORT: ${{ inputs.remote_docker_ssh_port }}
|
|
INPUT_REMOTE_DOCKER_SSH_USERNAME: ${{ inputs.remote_docker_ssh_username }}
|
|
INPUT_REMOTE_DOCKER_SSH_KEY: ${{ inputs.remote_docker_ssh_key }}
|
|
|
|
|