Add action
This commit is contained in:
parent
1a77505ef5
commit
7d72f3610f
80
.gitea/workflows/build-push-docker.yaml
Normal file
80
.gitea/workflows/build-push-docker.yaml
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# check this out: https://www.programonaut.com/how-to-deploy-a-docker-image-to-a-server-using-github-actions/
|
||||
name: Build and Publish
|
||||
run-name: ${{ gitea.actor }} is building docker image for thekendienstbot out Gitea Actions
|
||||
on: push
|
||||
# on:
|
||||
# push:
|
||||
# branches: [ "main" ]
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.lan.hobbyhimmel.de
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
CONTAINER_NAME: thekendienstbot
|
||||
IMAGE_NAME: ${{ env.OWNER }}/${{ env.CONTAINER_NAME }}
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: publish image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
||||
#- name: Login
|
||||
#run: echo ${{ secrets.BUILD_ACTION }} | docker login ${{ env.REGISTRY }} -u gitea --password-stdin
|
||||
- name: Login to gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.TOKEN_GITEA }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
file: docker/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
provenance: false
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.date.outputs.date }}-${{ env.GITHUB_SHA }}
|
||||
# - name: Build
|
||||
#run: |
|
||||
# echo "build ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} done"
|
||||
# docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} .
|
||||
#
|
||||
|
||||
#- name: Publish
|
||||
#run:# |
|
||||
#docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
deploy:
|
||||
needs: publish
|
||||
name: deploy image
|
||||
runs-on: backend_local
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Login to gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.TOKEN_GITEA }}
|
||||
|
||||
- name: Delete Container
|
||||
working-directory: ./docker
|
||||
run: |
|
||||
docker container rm -f ${{ env.CONTAINER_NAME }}
|
||||
- name: Compose Pull
|
||||
working-directory: ./docker
|
||||
run: |
|
||||
docker compose pull
|
||||
- name: Compose Up
|
||||
working-directory: ./docker
|
||||
run: |
|
||||
docker compose up -d
|
||||
|
|
@ -5,7 +5,7 @@ services:
|
|||
context: ../
|
||||
dockerfile: docker/Dockerfile
|
||||
|
||||
image: thekendienstbot:latest
|
||||
image: gitea.lan.hobbyhimmel.de/guibufolo/thekendienstbot:latest
|
||||
container_name: thekendienstbot
|
||||
environment:
|
||||
- TZ=Europe/Berlin
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user