From d55487246de926f78baaa46ff1fca234d4d06d44 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:36:37 +0000 Subject: [PATCH 01/10] Initial plan From d83018a4280e984c7b22673852d512a65dfbd382 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:39:24 +0000 Subject: [PATCH 02/10] Add GitHub Actions workflow for Docker build and push Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..e915b10 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,51 @@ +name: Docker Build + +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + branches: + - main + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ secrets.DOCKER_USERNAME }}/cloud-server + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From 6d00437ee160248d4e40b2d89c55917f4596edc1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:40:35 +0000 Subject: [PATCH 03/10] Improve Docker workflow with better comments and update README Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 7 +++++-- README.md | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e915b10..b94956b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,8 +20,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + # Login to Docker Hub (requires DOCKER_USERNAME and DOCKER_PASSWORD secrets) - name: Log in to Docker Hub - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -31,6 +32,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: + # Image will be named cloud-server under your Docker Hub username images: | ${{ secrets.DOCKER_USERNAME }}/cloud-server tags: | @@ -44,7 +46,8 @@ jobs: uses: docker/build-push-action@v5 with: context: . - push: ${{ github.event_name != 'pull_request' }} + # Only push if not a PR and Docker credentials are available + push: ${{ github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha diff --git a/README.md b/README.md index ed41e6f..783b0d5 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,13 @@ docker compose up -d The server will be available at ws://localhost:9080/. Logs are persisted in the `./logs` directory on the host. +Alternatively, you can pull the pre-built image from Docker Hub (if available): + +```bash +docker pull /cloud-server:latest +docker run -d -p 9080:9080 /cloud-server:latest +``` + To stop the server: ```bash @@ -108,3 +115,21 @@ server { ``` You may also want to make a systemd service file for the server, but this is left as an exercise to the reader. + +## Development + +### CI/CD + +This repository includes a GitHub Actions workflow that automatically builds and publishes Docker images: + +- **Trigger**: Automatically runs on push to `main` branch and on version tags (e.g., `v1.0.0`) +- **Image name**: `cloud-server` +- **Tags**: + - `latest` tag for main branch pushes + - Semantic version tags (e.g., `1.0.0`, `1.0`) for version tag pushes + +To enable Docker Hub publishing, configure the following repository secrets: +- `DOCKER_USERNAME`: Your Docker Hub username +- `DOCKER_PASSWORD`: Your Docker Hub password or access token + +The workflow will build the Docker image on every push and only push to Docker Hub if the secrets are configured. From 120a6be8bbb9fdf1237d1b40412a7bc495c39b4e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:41:54 +0000 Subject: [PATCH 04/10] Fix workflow secret checks to work with GitHub Actions Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b94956b..dce22e7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -22,7 +22,7 @@ jobs: # Login to Docker Hub (requires DOCKER_USERNAME and DOCKER_PASSWORD secrets) - name: Log in to Docker Hub - if: github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' + if: github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != null uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -34,7 +34,7 @@ jobs: with: # Image will be named cloud-server under your Docker Hub username images: | - ${{ secrets.DOCKER_USERNAME }}/cloud-server + ${{ secrets.DOCKER_USERNAME || 'local' }}/cloud-server tags: | type=ref,event=branch type=ref,event=pr @@ -47,7 +47,7 @@ jobs: with: context: . # Only push if not a PR and Docker credentials are available - push: ${{ github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }} + push: ${{ github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != null }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha From f27752e047fc1f6e21b0ed9b9a49d6aec646081c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:43:04 +0000 Subject: [PATCH 05/10] Use repository variable for controlling Docker push Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 6 +++--- README.md | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index dce22e7..d24a572 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -22,7 +22,7 @@ jobs: # Login to Docker Hub (requires DOCKER_USERNAME and DOCKER_PASSWORD secrets) - name: Log in to Docker Hub - if: github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != null + if: github.event_name != 'pull_request' && vars.DOCKER_ENABLED == 'true' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} @@ -46,8 +46,8 @@ jobs: uses: docker/build-push-action@v5 with: context: . - # Only push if not a PR and Docker credentials are available - push: ${{ github.event_name != 'pull_request' && secrets.DOCKER_USERNAME != null }} + # Only push if not a PR and DOCKER_ENABLED variable is set + push: ${{ github.event_name != 'pull_request' && vars.DOCKER_ENABLED == 'true' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha diff --git a/README.md b/README.md index 783b0d5..9627655 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ docker compose up -d The server will be available at ws://localhost:9080/. Logs are persisted in the `./logs` directory on the host. -Alternatively, you can pull the pre-built image from Docker Hub (if available): +Alternatively, you can pull the pre-built image from Docker Hub (replace `` with the Docker Hub username where the image is published): ```bash docker pull /cloud-server:latest @@ -132,4 +132,7 @@ To enable Docker Hub publishing, configure the following repository secrets: - `DOCKER_USERNAME`: Your Docker Hub username - `DOCKER_PASSWORD`: Your Docker Hub password or access token -The workflow will build the Docker image on every push and only push to Docker Hub if the secrets are configured. +And set this repository variable: +- `DOCKER_ENABLED`: Set to `true` to enable Docker Hub publishing + +The workflow will build the Docker image on every push and only push to Docker Hub if the `DOCKER_ENABLED` variable is set to `true`. From c73a6753c93c038426e20d9c31a54560130c472a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:44:12 +0000 Subject: [PATCH 06/10] Use repository owner as fallback and clarify Docker Hub instructions Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 3 ++- README.md | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d24a572..d0ce80b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,8 +33,9 @@ jobs: uses: docker/metadata-action@v5 with: # Image will be named cloud-server under your Docker Hub username + # Falls back to GitHub repository owner for local builds images: | - ${{ secrets.DOCKER_USERNAME || 'local' }}/cloud-server + ${{ secrets.DOCKER_USERNAME || github.repository_owner }}/cloud-server tags: | type=ref,event=branch type=ref,event=pr diff --git a/README.md b/README.md index 9627655..fa4c8f7 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,11 @@ docker compose up -d The server will be available at ws://localhost:9080/. Logs are persisted in the `./logs` directory on the host. -Alternatively, you can pull the pre-built image from Docker Hub (replace `` with the Docker Hub username where the image is published): +Alternatively, if Docker Hub publishing is configured for this repository, you can pull the pre-built image: ```bash +# Replace with the actual Docker Hub username configured in the repository +# Check the repository's GitHub Actions or ask the maintainer for the Docker Hub username docker pull /cloud-server:latest docker run -d -p 9080:9080 /cloud-server:latest ``` From 4952ff2556dfe9e320bd67e94f50b2a1fc1f084b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:45:21 +0000 Subject: [PATCH 07/10] Clean up Docker tags and improve README instructions Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 2 -- README.md | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d0ce80b..53e7db8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -37,8 +37,6 @@ jobs: images: | ${{ secrets.DOCKER_USERNAME || github.repository_owner }}/cloud-server tags: | - type=ref,event=branch - type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest,enable={{is_default_branch}} diff --git a/README.md b/README.md index fa4c8f7..c00c0be 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,12 @@ The server will be available at ws://localhost:9080/. Logs are persisted in the Alternatively, if Docker Hub publishing is configured for this repository, you can pull the pre-built image: ```bash -# Replace with the actual Docker Hub username configured in the repository -# Check the repository's GitHub Actions or ask the maintainer for the Docker Hub username +# To find the Docker Hub username: +# 1. Go to the repository's Actions tab on GitHub +# 2. Look for successful "Docker Build" workflow runs +# 3. Check the workflow logs for the image name being pushed +# OR ask the repository maintainer for the Docker Hub username + docker pull /cloud-server:latest docker run -d -p 9080:9080 /cloud-server:latest ``` From 1b7ebad0741ac84d0c0efe77b5e911887c39999c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:46:14 +0000 Subject: [PATCH 08/10] Add enable conditions to semver tag patterns Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 53e7db8..7bc2241 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -37,8 +37,8 @@ jobs: images: | ${{ secrets.DOCKER_USERNAME || github.repository_owner }}/cloud-server tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/') }} type=raw,value=latest,enable={{is_default_branch}} - name: Build and push Docker image From a1f325ccfba1b50ae1d2d4c04acc13f99424a9d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:47:17 +0000 Subject: [PATCH 09/10] Remove unnecessary enable conditions from semver patterns Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7bc2241..53e7db8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -37,8 +37,8 @@ jobs: images: | ${{ secrets.DOCKER_USERNAME || github.repository_owner }}/cloud-server tags: | - type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} - type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} type=raw,value=latest,enable={{is_default_branch}} - name: Build and push Docker image From 1e92142d9f0d03338cbdb2d971eeac8ba370e027 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:48:35 +0000 Subject: [PATCH 10/10] Add explicit GITHUB_TOKEN permissions for security Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- .github/workflows/docker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 53e7db8..941ce08 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,6 +13,9 @@ on: jobs: docker: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout uses: actions/checkout@v4