add parts for odcker build and gitea action build

This commit is contained in:
2025-12-14 19:51:36 +01:00
parent 928c2f23c8
commit 971cdd4461
6 changed files with 254 additions and 1 deletions

View File

@@ -0,0 +1,69 @@
# Gitea Actions Workflows
This directory contains Gitea Actions workflows for automated builds and releases.
## Build and Release Workflow
The `build-release.yml` workflow automatically builds Docker images and attaches them to Gitea releases.
### Setup
1. **Enable Gitea Actions**: Ensure Actions are enabled on your Gitea instance (Settings → Actions)
2. **Configure Token**: The workflow uses `secrets.GITHUB_TOKEN` which Gitea provides automatically. If your Gitea version uses a different token name, you may need to:
- Update the workflow to use `secrets.GITEA_TOKEN` instead
- Or create a custom token secret in your repository settings
3. **API URL**: The workflow uses `github.api_url` which Gitea Actions should provide. If you encounter issues, you may need to manually set the Gitea API URL in the workflow.
### Usage
**Automatic Release on Tag Push:**
```bash
git tag v1.0.0
git push origin v1.0.0
```
The workflow will:
1. Build a Docker image tagged with the version
2. Save it as a compressed tar file
3. Create or update a Gitea release
4. Attach the tar file to the release
**Manual Trigger:**
You can also trigger the workflow manually from the Gitea Actions UI. The image will be saved as an artifact (not attached to a release).
### Loading the Image
After downloading the `.tar.gz` file from a release:
```bash
# Load the image
docker load < automatic-linkedin-answer-ai-v1.0.0.tar.gz
# Verify it's loaded
docker images | grep automatic-linkedin-answer-ai
# Run the container
docker run -it \
-v $(pwd)/config.yaml:/app/config.yaml \
-v $(pwd)/docs:/app/docs \
automatic-linkedin-answer-ai:v1.0.0
```
### Troubleshooting
**Workflow fails with authentication errors:**
- Check that Actions are enabled on your Gitea instance
- Verify the token secret is available (should be automatic with Gitea Actions)
- If using a self-hosted Gitea, ensure the API URL is accessible from the runner
**Release not created:**
- Ensure you're pushing a tag that matches the pattern `v*` (e.g., `v1.0.0`)
- Check the workflow logs for specific error messages
- Verify you have write permissions to the repository
**Image too large:**
- The workflow compresses the image with gzip
- Consider using multi-stage builds in the Dockerfile to reduce image size
- You may need to adjust Gitea's upload size limits if the image is very large