forked from external-repos/ivatar-docker
Add Gitea Actions CI/CD workflow and update README with setup instructions
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m53s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m53s
This commit is contained in:
50
.gitea/workflows/build-and-push.yml
Normal file
50
.gitea/workflows/build-and-push.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
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
|
||||||
|
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.purpleraft.com
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: gitea.purpleraft.com/${{ gitea.repository }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=sha,prefix={{branch}}-
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
29
README.md
29
README.md
@@ -30,6 +30,35 @@ Please be aware that this will not persist any data.
|
|||||||
| `POSTGRESQL_PASSWORD` | | - |
|
| `POSTGRESQL_PASSWORD` | | - |
|
||||||
|
|
||||||
|
|
||||||
|
## Gitea Actions CI/CD
|
||||||
|
|
||||||
|
This repository includes a Gitea Actions workflow that automatically builds and pushes the Docker image to your Gitea container registry.
|
||||||
|
|
||||||
|
### Setup Instructions
|
||||||
|
|
||||||
|
1. **Create a Personal Access Token:**
|
||||||
|
- Go to your Gitea instance: https://gitea.purpleraft.com/
|
||||||
|
- Navigate to Settings → Applications → Generate New Token
|
||||||
|
- Create a token with `write:packages` permission
|
||||||
|
- Copy the token value
|
||||||
|
|
||||||
|
2. **Add Repository Secret:**
|
||||||
|
- Go to your repository settings
|
||||||
|
- Navigate to Secrets and Variables → Actions
|
||||||
|
- Add a new secret named `GITEA_TOKEN` with your personal access token as the value
|
||||||
|
|
||||||
|
3. **Enable Actions (if not already enabled):**
|
||||||
|
- Ensure Gitea Actions are enabled in your repository settings
|
||||||
|
- The workflow will trigger on pushes to main/master branches and pull requests
|
||||||
|
|
||||||
|
### Workflow Features
|
||||||
|
|
||||||
|
- Builds Docker image using Docker Buildx
|
||||||
|
- Pushes to `gitea.purpleraft.com/{username}/{repository}`
|
||||||
|
- Creates multiple tags: branch name, latest (for default branch), and commit SHA
|
||||||
|
- Uses GitHub Actions cache for faster builds
|
||||||
|
- Runs on pushes and pull requests
|
||||||
|
|
||||||
## To Do
|
## To Do
|
||||||
- Figure out where the pictures are stored
|
- Figure out where the pictures are stored
|
||||||
- Write some setup instructions
|
- Write some setup instructions
|
||||||
|
|||||||
Reference in New Issue
Block a user