cmziuk/.forgejo/workflows/build-and-dockerise.yml
Cameron Redmore 214982649f
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m25s
Add Docker support and implement Bun for dependency management
- Introduced .dockerignore to exclude unnecessary files from Docker context.
- Updated Dockerfile to use Bun for building and running the application.
- Removed entrypoint.sh as it is no longer needed.
- Modified build-and-dockerise.yml to set up Bun and install dependencies.
- Enhanced index.html with improved structure and hover effects.
- Updated client.ts to include tooltips for music display.
- Implemented caching in server.ts for Last.fm data.
- Added custom styles for hover effects and tooltips in style.css.
2025-08-08 11:18:39 +01:00

82 lines
No EOL
2.6 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches:
- turquoise
tags:
- 'v*.*.*' # Trigger on version tags
env:
REGISTRY: git.cmzi.uk
# Use 'github' context variables as fallbacks for repo owner and name
IMAGE_BASE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: alpine-latest # Or your preferred runner with Docker
permissions:
contents: read
packages: write # Still required for pushing to the registry
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Recommended for metadata action
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
shell: sh
- name: Build project
run: bun run build
shell: sh
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Forgejo Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }} # Use the registry URL defined above
# Use 'github.actor' as a fallback for the username context
username: ${{ github.repository_owner }}
# Use the Forgejo-specific token - this SHOULD still work if Actions are enabled
password: ${{ secrets.RUNNER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
# Construct the full image name using the defined REGISTRY and IMAGE_BASE_NAME
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASE_NAME }}
tags: |
# Use 'github.ref' for branch/tag detection
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'turquoise') }}
type=ref,event=branch
type=ref,event=tag
type=sha,format=short # Tag with short Git SHA
# Add standard OCI labels using github context
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }} # Use tags from metadata step
labels: ${{ steps.meta.outputs.labels }} # Use labels from metadata step
cache-from: type=gha
cache-to: type=gha,mode=max