34 lines
1022 B
YAML
34 lines
1022 B
YAML
name: Build and Deploy
|
|
on: [ push ]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest # This refers to your self-hosted runner
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to Gitea Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: git.ludops.com
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.CI_TOKEN }}
|
|
|
|
- name: Build and Push
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: git.ludops.com/${{ gitea.repository }}:latest
|
|
|
|
- name: Deploy to Server
|
|
run: |
|
|
# Here we tell the server to pull the new image and restart
|
|
echo "${{ secrets.CI_TOKEN }}" | docker login git.ludops.com -u ${{ gitea.actor }} --password-stdin
|
|
docker compose -f docker-compose.prod.yml pull
|
|
docker compose -f docker-compose.prod.yml up -d
|