40 - Add Forgejo CI workflow for Docker builds
Some checks failed
Build and Push Docker Image / build (push) Failing after 5m58s
Some checks failed
Build and Push Docker Image / build (push) Failing after 5m58s
This commit is contained in:
parent
71e7611e65
commit
8ea0365b8b
4 changed files with 45 additions and 101 deletions
41
.forgejo/workflows/build.yml
Normal file
41
.forgejo/workflows/build.yml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
name: Build and Push Docker Image
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://data.forgejo.org/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Forgejo Registry
|
||||
uses: https://data.forgejo.org/docker/login-action@v3
|
||||
with:
|
||||
registry: forge.lvl0.xyz
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Determine tags
|
||||
id: meta
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
||||
TAG="${{ github.ref_name }}"
|
||||
echo "tags=forge.lvl0.xyz/lvl0/fedi-feed-router:${TAG},forge.lvl0.xyz/lvl0/fedi-feed-router:latest" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "tags=forge.lvl0.xyz/lvl0/fedi-feed-router:latest" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Build and push
|
||||
uses: https://data.forgejo.org/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
|
@ -13,14 +13,14 @@ ## Features
|
|||
|
||||
## Self-hosting
|
||||
|
||||
The production image is available at `codeberg.org/lvl0/ffr:latest`.
|
||||
The production image is available at `forge.lvl0.xyz/lvl0/fedi-feed-router:latest`.
|
||||
|
||||
### docker-compose.yml
|
||||
|
||||
```yaml
|
||||
services:
|
||||
app:
|
||||
image: codeberg.org/lvl0/ffr:latest
|
||||
image: forge.lvl0.xyz/lvl0/fedi-feed-router:latest
|
||||
container_name: ffr_app
|
||||
restart: always
|
||||
ports:
|
||||
|
|
@ -86,7 +86,7 @@ ## Development
|
|||
### NixOS / Nix
|
||||
|
||||
```bash
|
||||
git clone https://codeberg.org/lvl0/ffr.git
|
||||
git clone https://forge.lvl0.xyz/lvl0/fedi-feed-router.git
|
||||
cd ffr
|
||||
nix-shell
|
||||
```
|
||||
|
|
@ -104,7 +104,6 @@ #### Available Commands
|
|||
| `dev-logs-db` | Follow database logs |
|
||||
| `dev-shell` | Enter app container |
|
||||
| `dev-artisan <cmd>` | Run artisan commands |
|
||||
| `prod-build [tag]` | Build and push prod image (default: latest) |
|
||||
|
||||
#### Services
|
||||
|
||||
|
|
@ -125,4 +124,4 @@ ## License
|
|||
|
||||
## Support
|
||||
|
||||
For issues and questions, please use [Codeberg Issues](https://codeberg.org/lvl0/ffr/issues).
|
||||
For issues and questions, please use [Issues](https://forge.lvl0.xyz/lvl0/fedi-feed-router/issues).
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
# ===================
|
||||
# FFR Production Services
|
||||
# ===================
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: Dockerfile
|
||||
image: codeberg.org/lvl0/ffr:latest
|
||||
container_name: ffr_app
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
APP_NAME: "${APP_NAME:-FFR}"
|
||||
APP_KEY: "${APP_KEY}"
|
||||
APP_URL: "${APP_URL}"
|
||||
DB_HOST: db
|
||||
DB_PORT: 3306
|
||||
DB_DATABASE: "${DB_DATABASE:-ffr}"
|
||||
DB_USERNAME: "${DB_USERNAME:-ffr}"
|
||||
DB_PASSWORD: "${DB_PASSWORD}"
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
networks:
|
||||
- ffr-network
|
||||
|
||||
db:
|
||||
image: mariadb:11
|
||||
container_name: ffr_db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_DATABASE: "${DB_DATABASE:-ffr}"
|
||||
MYSQL_USER: "${DB_USERNAME:-ffr}"
|
||||
MYSQL_PASSWORD: "${DB_PASSWORD}"
|
||||
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
networks:
|
||||
- ffr-network
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: ffr_redis
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- ffr-network
|
||||
|
||||
networks:
|
||||
ffr-network:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
redis_data:
|
||||
27
shell.nix
27
shell.nix
|
|
@ -81,32 +81,6 @@ pkgs.mkShell {
|
|||
podman-compose -f $COMPOSE_FILE exec app php artisan "$@"
|
||||
}
|
||||
|
||||
# ===================
|
||||
# PROD COMMANDS
|
||||
# ===================
|
||||
prod-build() {
|
||||
local tag="''${1:-latest}"
|
||||
local image="codeberg.org/lvl0/ffr:$tag"
|
||||
|
||||
echo "Building production image: $image"
|
||||
if ! podman build -t "$image" -f Dockerfile .; then
|
||||
echo "Build failed!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Pushing to registry..."
|
||||
if ! podman push "$image"; then
|
||||
echo ""
|
||||
echo "Push failed! You may need to login first:"
|
||||
echo " podman login codeberg.org"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Done! Image pushed: $image"
|
||||
}
|
||||
|
||||
# ===================
|
||||
# WELCOME MESSAGE
|
||||
# ===================
|
||||
|
|
@ -125,7 +99,6 @@ pkgs.mkShell {
|
|||
echo " dev-logs-db Tail database logs"
|
||||
echo " dev-shell Shell into app container"
|
||||
echo " dev-artisan <cmd> Run artisan command"
|
||||
echo " prod-build [tag] Build and push prod image (default: latest)"
|
||||
echo ""
|
||||
echo "Services:"
|
||||
echo " app Laravel + Vite http://localhost:8000"
|
||||
|
|
|
|||
Loading…
Reference in a new issue