Update docker.yaml

This commit is contained in:
Zakary Timson 2023-07-28 14:44:12 +00:00
parent cf1be65cb6
commit dc38bc3ef3

View File

@ -1,45 +1,39 @@
name: Build & push docker image name: Push docker image
description: Build the local docker file & push to the registry
on: inputs:
workflow_call: registry:
inputs: required: false
registry: type: string
required: false image:
type: string required: true
image: type: string
required: true tag:
type: string required: false
tag: type: string
required: false secrets:
type: string registry_user:
secrets: required: true
registry_user: type: string
required: true registry_pass:
type: string required: true
registry_pass: type: string
required: true
type: string
jobs: runs:
build: using: composite
name: Build & push docker image steps:
runs-on: Docker - name: Login to registry
container: run: |
image: docker:latest REGISTRY=$([ -n "${{inputs.registry}}" ] && echo "${{inputs.registry}}" || echo "$GITHUB_SERVER_URL")
steps: echo "${{secrets.registry_pass}}" | docker login -u "${{secrets.registry_user}}" --password-stdin "$REGISTRY"
- name: Login to registry - uses: actions/checkout@v3
run: |
REGISTRY=$([ "${{inputs.registry}}" -n ] && echo "${{inputs.registry}}" || echo "$GITHUB_SERVER_URL")
echo "${{secrets.registry_pass}}" | docker login -u "${{secrets.registry_user}}" --password-stdin "$REGISTRY"
- uses: actions/checkout@v3 - name: Create tag
run: TAG=$([ -n "${{inputs.tag}}" ] && echo "${{inputs.tag}}" || [ "$GITHUB_REF" == "refs/heads/develop" ] && echo "latest" || echo "$GITHUB_REF_NAME" | sed -E "s/[_/]/-/g")
- name: Create tag - name: Build image
run: TAG=$([ "${{inputs.tag}}" -n ] && echo "${{inputs.tag}}" || [ "$GITHUB_REF" == "refs/heads/develop" ] && echo "latest" || echo "$GITHUB_REF_NAME" | sed -E "s/[_/]/-/g") run: docker build --no-cache -t "${{inputs.image}}:$TAG" .
- name: Build image - name: Push image
run: docker build --no-cache -t "${{inputs.image}}:$TAG" . run: docker push "${{inputs.image}}:$TAG"
- name: Push image
run: docker push "${{inputs.image}}:$TAG"