Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 4s
50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: dind
|
|
container:
|
|
image: docker:cli
|
|
services:
|
|
dind:
|
|
image: docker:dind
|
|
options: --privileged
|
|
env:
|
|
DOCKER_TLS_CERTDIR: ""
|
|
env:
|
|
DOCKER_HOST: tcp://dind:2375
|
|
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apk add --no-cache git
|
|
GITEA_HOST="${{ gitea.server_url }}"
|
|
GITEA_HOST="${GITEA_HOST#https://}"
|
|
GITEA_HOST="${GITEA_HOST#http://}"
|
|
git clone "https://oauth2:${{ secrets.GITEA_TOKEN }}@${GITEA_HOST}/${{ gitea.repository }}.git" .
|
|
git checkout ${{ gitea.sha }}
|
|
|
|
- name: Log in to Gitea registry
|
|
run: |
|
|
REGISTRY="${{ gitea.server_url }}"
|
|
REGISTRY="${REGISTRY#https://}"
|
|
REGISTRY="${REGISTRY#http://}"
|
|
echo "${{ secrets.GITEA_TOKEN }}" | docker login "$REGISTRY" -u "${{ gitea.actor }}" --password-stdin
|
|
|
|
- name: Build and push
|
|
run: |
|
|
REGISTRY="${{ gitea.server_url }}"
|
|
REGISTRY="${REGISTRY#https://}"
|
|
REGISTRY="${REGISTRY#http://}"
|
|
IMAGE="$REGISTRY/${{ gitea.repository }}"
|
|
docker build -t "$IMAGE:${{ gitea.sha }}" -t "$IMAGE:latest" .
|
|
docker push "$IMAGE:${{ gitea.sha }}"
|
|
docker push "$IMAGE:latest"
|