dfix pipeline
This commit is contained in:
@@ -1,26 +1,47 @@
|
||||
name: Gitea Actions Demo
|
||||
name: Build and Push to Gitea Registry
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-and-run:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
# If your Gitea instance uses HTTP (not HTTPS), add this
|
||||
config-inline: |
|
||||
[registry."${{ gitea.server_url }}"]
|
||||
http = true
|
||||
insecure = true
|
||||
|
||||
# Login to Docker Hub for pulling base images
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5 # Updated to v5
|
||||
# Login to Gitea Registry for pushing
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ gitea.server_url }} # e.g., gitea.example.com or 192.168.1.100:3000
|
||||
username: ${{ gitea.repository_owner }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Build and push to Gitea Registry
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ github.repository }}:latest
|
||||
|
||||
- name: Run container
|
||||
run: |
|
||||
docker run -d -p 8000:8000 ${{ github.repository }}:latest
|
||||
# Pull base images from Docker Hub (automatically authenticated)
|
||||
# Push final image to Gitea Registry
|
||||
tags: |
|
||||
${{ gitea.server_url }}/${{ gitea.repository_owner }}/kulakpos_web:latest
|
||||
${{ gitea.server_url }}/${{ gitea.repository_owner }}/kulakpos_web:${{ github.sha }}
|
||||
# Optional: Add cache from Docker Hub to speed up builds
|
||||
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/kulakpos_web:buildcache
|
||||
cache-to: type=registry,ref=${{ gitea.server_url }}/${{ gitea.repository_owner }}/kulakpos_web:buildcache,mode=max
|
||||
Reference in New Issue
Block a user