From 9f05a56d3ff89f124eac36fee114d0dec303d1c7 Mon Sep 17 00:00:00 2001 From: Yixuan Han <105723997+hanyixuanten@users.noreply.github.com> Date: Fri, 25 Sep 2026 11:15:21 +0800 Subject: [PATCH 1/3] Add GitHub Actions workflow for Docker image publishing --- .github/workflows/docker-ghcr.yml | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/docker-ghcr.yml diff --git a/.github/workflows/docker-ghcr.yml b/.github/workflows/docker-ghcr.yml new file mode 100644 index 0000000000..1bdbb48bd8 --- /dev/null +++ b/.github/workflows/docker-ghcr.yml @@ -0,0 +1,70 @@ +name: Publish Docker images to GHCR + +on: + push: + branches: + - master + tags: + - 'v*' + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + publish: + name: Build and push ${{ matrix.name }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: backend + image: hydro-backend + context: ./install/docker/backend + - name: judge + image: hydro-judge + context: ./install/docker/judge + + steps: + - name: Check out 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: Lowercase GitHub owner for GHCR + run: echo "OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_ENV" + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ env.OWNER_LC }}/${{ matrix.image }} + tags: | + type=ref,event=branch + type=ref,event=tag + type=sha,prefix=sha- + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push ${{ matrix.name }} image + uses: docker/build-push-action@v6 + with: + context: ${{ matrix.context }} + file: ${{ matrix.context }}/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=${{ matrix.image }} + cache-to: type=gha,mode=max,scope=${{ matrix.image }} From 8e5be6ce796d9afb313c175d6f29f7a37fb8d3d3 Mon Sep 17 00:00:00 2001 From: Yixuan Han <105723997+hanyixuanten@users.noreply.github.com> Date: Fri, 25 Sep 2026 11:33:09 +0800 Subject: [PATCH 2/3] [skip ci] Update Docker Compose to use images instead of builds --- install/docker/docker-compose.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/install/docker/docker-compose.yml b/install/docker/docker-compose.yml index b5b2b06c4d..86342574e6 100644 --- a/install/docker/docker-compose.yml +++ b/install/docker/docker-compose.yml @@ -13,10 +13,12 @@ services: timeout: 10s retries: 5 start_period: 30s + oj-backend: - build: ./backend + image: ghcr.io/hydro-dev/hydro-backend:latest container_name: oj-backend restart: always + pull_policy: always depends_on: oj-mongo: condition: service_healthy @@ -25,7 +27,7 @@ services: - ./data/file:/data/file - ./data/backend:/root/.hydro ports: - - "80:8888" # In docker mode, change THIS port instead of port in system settings! + - "40015:8888" healthcheck: test: curl --silent --fail http://localhost:8888/status >/dev/null || exit 1 interval: 1m30s @@ -33,11 +35,16 @@ services: retries: 3 start_period: 30s start_interval: 5s + ulimits: + stack: + soft: -1 + hard: -1 oj-judge: - build: ./judge + image: ghcr.io/hydro-dev/hydro-judge:latest container_name: oj-judge restart: always + pull_policy: always privileged: true depends_on: oj-backend: @@ -46,3 +53,7 @@ services: volumes: - ./judge/judge.yaml:/root/.hydro/judge.yaml - ./judge/mount.yaml:/root/.hydro/mount.yaml + ulimits: + stack: + soft: -1 + hard: -1 From 04b3ee4f617b56a170ade0af4db2e93d77635c34 Mon Sep 17 00:00:00 2001 From: Yixuan Han <105723997+hanyixuanten@users.noreply.github.com> Date: Fri, 25 Sep 2026 11:38:30 +0800 Subject: [PATCH 3/3] [skip ci] Update Docker port mapping to 80 --- install/docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/docker/docker-compose.yml b/install/docker/docker-compose.yml index 86342574e6..0f3ba70cc9 100644 --- a/install/docker/docker-compose.yml +++ b/install/docker/docker-compose.yml @@ -27,7 +27,7 @@ services: - ./data/file:/data/file - ./data/backend:/root/.hydro ports: - - "40015:8888" + - "80:8888" # In docker mode, change THIS port instead of port in system settings! healthcheck: test: curl --silent --fail http://localhost:8888/status >/dev/null || exit 1 interval: 1m30s