54 lines
1.7 KiB
YAML
Raw Normal View History

2025-01-02 15:17:00 +00:00
name: Publish Docker Image
on:
push:
branches:
- main
2025-01-02 15:33:46 +00:00
schedule:
- cron: '@weekly'
2025-01-02 15:17:00 +00:00
2025-01-02 15:44:02 +00:00
env:
DOCKER_OPTS: '--insecure-registry 15.206.81.210:9000'
2025-01-02 15:17:00 +00:00
jobs:
publish:
runs-on: ubuntu-latest
2025-01-02 15:24:02 +00:00
permissions:
packages: write
contents: read
2025-01-02 15:17:00 +00:00
steps:
2025-01-02 16:06:25 +00:00
- name: Update Docker configuration
continue-on-error: true
run: |
echo "DOCKER_OPTS=\"--insecure-registry ${{ vars.PACKAGES_REGISTRY_URL }}\"" >> /etc/default/docker
echo "{\"insecure-registries\": [\"${{ vars.PACKAGES_REGISTRY_URL }}\"]}" > /etc/docker/daemon.json
systemctl restart docker
2025-01-02 15:17:00 +00:00
- name: Check out repository code
2025-01-02 15:29:22 +00:00
uses: actions/checkout@v4.2.2
2025-01-02 15:17:00 +00:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
2025-01-02 15:40:07 +00:00
# - name: Log in to Gitea Package Registry
# uses: docker/login-action@v3
# with:
# registry: ${{ vars.PACKAGES_REGISTRY_URL }}
# username: ${{ vars.PACKAGES_REGISTRY_USERNAME }}
# password: ${{ secrets.PACKAGES_REGISTRY_PASSWORD }}
2025-01-02 15:17:00 +00:00
- name: Log in to Gitea Package Registry
2025-01-02 15:40:07 +00:00
run: echo ${{ secrets.PACKAGES_REGISTRY_PASSWORD }} | docker login ${{ vars.PACKAGES_REGISTRY_URL }} -u ${{ vars.PACKAGES_REGISTRY_USERNAME }} --password-stdin
2025-01-02 15:17:00 +00:00
with:
2025-01-02 15:33:46 +00:00
registry: ${{ vars.PACKAGES_REGISTRY_URL }}
2025-01-02 15:29:22 +00:00
username: ${{ vars.PACKAGES_REGISTRY_USERNAME }}
password: ${{ secrets.PACKAGES_REGISTRY_PASSWORD }}
2025-01-02 15:17:00 +00:00
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
2025-01-02 15:29:22 +00:00
tags: ${{ env.REGISTRY_URL }}/${{ gitea.repository }}:latest