From 6e165d65b674cf73f21f7d9327763e376b2f8d3d Mon Sep 17 00:00:00 2001 From: bitc0de Date: Wed, 17 Dec 2025 14:19:31 +0100 Subject: [PATCH] Setup github actions for docker publishing --- .github/workflows/docker-publish.yml | 57 ++++++++++++++++++++++++++++ README.md | 35 +++++++++++++++-- docker-compose.yml | 4 +- 3 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..935a507 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,57 @@ +name: Build and Push Docker Image + +on: + push: + tags: + - 'v*.*.*' + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/README.md b/README.md index 11ca747..e0db941 100644 --- a/README.md +++ b/README.md @@ -67,21 +67,48 @@ Self-hosted YouTube music streaming application built with Next.js. 5. **Open your browser:** Navigate to [http://localhost:3000](http://localhost:3000) -## Docker Deployment +## Quick Start with Docker (Recommended) -1. **Build and run with Docker Compose:** +1. **Download the docker-compose.yml file:** + ```bash + wget https://raw.githubusercontent.com/bitc0de/bitify/main/docker-compose.yml + ``` + Or on Windows PowerShell: + ```powershell + Invoke-WebRequest -Uri https://raw.githubusercontent.com/bitc0de/bitify/main/docker-compose.yml -OutFile docker-compose.yml + ``` + +2. **Start the application:** ```bash docker-compose up -d ``` -2. **Access the application:** +3. **Access the application:** Navigate to [http://localhost:3000](http://localhost:3000) -3. **Stop the application:** +4. **Stop the application:** ```bash docker-compose down ``` +The Docker image is automatically built and published to GitHub Container Registry on each release. + +## Build from Source + +If you prefer to build the Docker image yourself: + +1. **Clone the repository:** + ```bash + git clone https://github.com/bitc0de/bitify.git + cd bitify + ``` + +2. **Build and run:** + ```bash + docker build -t bitify . + docker-compose up -d + ``` + ## Usage 1. **Add a song**: Paste a YouTube URL in the input field and click "Add" diff --git a/docker-compose.yml b/docker-compose.yml index 522c622..260d191 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,7 @@ version: '3.8' services: bitify: - build: - context: . - dockerfile: Dockerfile + image: ghcr.io/bitc0de/bitify:latest container_name: bitify ports: - "3000:3000"