Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# http://editorconfig.org
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_size = 4
indent_style = space

[*.{yml,yaml}]
charset = utf-8
indent_style = space
indent_size = 2
64 changes: 64 additions & 0 deletions .github/workflows/build_chroot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# yaml-language-server: $schema=https://json-schema.org/draft-07/schema#
name: Build Chroot

on:
workflow_dispatch:
inputs:
version:
description: "version"
required: true
default: "latest"
repo:
description: "repo"
required: true
default: "DOMjudge/domjudge"
commit_id:
description: "git commit id"
required: false

jobs:
build-chroot:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Download DOMjudge
run: |
bash ./docker/download.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.repo }} ${{ github.event.inputs.commit_id }}

- name: Build and Push
uses: docker/build-push-action@v2
with:
context: ./docker
file: ./docker/judgehost/Dockerfile.chroot
platforms: linux/amd64,linux/arm64
push: true
tags: dup4/domjudge-default-judgehost-chroot:${{ github.event.inputs.version }}
78 changes: 78 additions & 0 deletions .github/workflows/build_domserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# yaml-language-server: $schema=https://json-schema.org/draft-07/schema#
name: Build Domserver

on:
workflow_dispatch:
inputs:
version:
description: "version"
required: true
default: "latest"
repo:
description: "repo"
required: true
default: "DOMjudge/domjudge"
commit_id:
description: "git commit id"
required: false

jobs:
build-domserver:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to ALiYun Shanghai Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-shanghai.aliyuncs.com
username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
password: ${{ secrets.ALIYUN_REGISTRY_TOKEN }}

- name: Download DOMjudge
run: |
bash ./docker/download.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.repo }} ${{ github.event.inputs.commit_id }}

- name: Build and Push
uses: docker/build-push-action@v5
env:
registry_namespace: dup4
image_name: domjudge-domserver
tag: ${{ github.event.inputs.version }}
with:
context: ./docker
file: ./docker/domserver/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }}
registry.cn-shanghai.aliyuncs.com/${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }}
80 changes: 80 additions & 0 deletions .github/workflows/build_judgehost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# yaml-language-server: $schema=https://json-schema.org/draft-07/schema#
name: Build Judgehost

on:
workflow_dispatch:
inputs:
version:
description: "version"
required: true
default: "latest"
repo:
description: "repo"
required: true
default: "DOMjudge/domjudge"
commit_id:
description: "git commit id"
required: false

jobs:
build-judgehost:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to ALiYun Shanghai Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-shanghai.aliyuncs.com
username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
password: ${{ secrets.ALIYUN_REGISTRY_TOKEN }}

- name: Download DOMjudge
run: |
bash ./docker/download.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.repo }} ${{ github.event.inputs.commit_id }}

- name: Build
env:
tag: ${{ github.event.inputs.version }}
run: |
cd ./docker
sudo bash -e build-judgehost.sh dup4/domjudge-judgehost:${{ env.tag }}

- name: Push
env:
registry_namespace: dup4
image_name: domjudge-judgehost
tag: ${{ github.event.inputs.version }}
run: |
docker push ${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }}
docker tag ${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }} registry.cn-shanghai.aliyuncs.com/${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }}
docker push registry.cn-shanghai.aliyuncs.com/${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }}
65 changes: 65 additions & 0 deletions .github/workflows/build_judgehost_in_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# yaml-language-server: $schema=https://json-schema.org/draft-07/schema#
name: Build Judgehost In Docker

on:
workflow_dispatch:
inputs:
version:
description: "version"
required: true
default: "latest"
repo:
description: "repo"
required: true
default: "DOMjudge/domjudge"
commit_id:
description: "git commit id"
required: false

jobs:
build-judgehost-in-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Download DOMjudge
run: |
bash ./docker/download.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.repo }} ${{ github.event.inputs.commit_id }}

- name: Build and Push
uses: docker/build-push-action@v2
with:
context: ./docker
file: ./docker/judgehost/Dockerfile.all
platforms: linux/amd64,linux/arm64
allow: security.insecure
push: true
tags: dup4/domjudge-judgehost:${{ github.event.inputs.version }}
2 changes: 2 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ jobs:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
severity: error
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"cSpell.words": [
"buildx",
"DOCKERHUB",
"domjudge",
"judgehost",
"shellcheck"
],
}
2 changes: 2 additions & 0 deletions docker/domserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM debian:bookworm-slim AS domserver-build
LABEL org.opencontainers.image.authors="DOMjudge team <[email protected]>"

ENV DEBIAN_FRONTEND=noninteractive
ENV COMPOSER_ALLOW_SUPERUSER=1

# Install required packages for build of domserver
RUN apt-get update \
Expand All @@ -17,6 +18,7 @@ RUN apt-get update \
texlive-fonts-recommended texlive-lang-european latexmk tex-gyre \
libcurl4-gnutls-dev libjsoncpp-dev libmagic-dev \
enscript lpr ca-certificates \
moreutils \
&& rm -rf /var/lib/apt/lists/*

# Use venv to install latest Sphinx. 6.1.0 or higher is required to build DOMjudge docs.
Expand Down
51 changes: 51 additions & 0 deletions docker/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#! /bin/bash

TOP_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
FILE_NAME="domjudge"
FILE="${TOP_DIR}/${FILE_NAME}.tar.gz"
DIR="${TOP_DIR}/${FILE_NAME}"

VERSION="${1}"
REPO="${2}"
COMMIT_ID="${3}"

if [[ -z "${VERSION}" ]]; then
VERSION="latest"
fi

if [[ -z "${REPO}" ]]; then
REPO="DOMjudge/domjudge"
fi

if command -v git >/dev/null 2>&1; then
GIT_COMMAND="git clone https://github.com/${REPO}.git"
if [[ -z "${COMMIT_ID}" ]] && [[ X"${VERSION}" != X"latest" ]]; then
GIT_COMMAND="${GIT_COMMAND} -b ${VERSION}"
fi

GIT_COMMAND="${GIT_COMMAND} ${DIR}"

${GIT_COMMAND}

if [[ -n "${COMMIT_ID}" ]]; then
cd "${DIR}" || exit 1
git reset --hard "${COMMIT_ID}"
cd - || exit 1
fi

tar -cvzf "${FILE}" -C "${TOP_DIR}" "${FILE_NAME}"
rm -rf "${DIR}"
else
if [[ X"${VERSION}" = X"latest" ]]; then
URL=https://codeload.github.com/${REPO}/tar.gz/refs/heads/main
else
URL=https://codeload.github.com/${REPO}/tar.gz/refs/tags/${VERSION}
fi

echo "[..] Downloading DOMjudge version ${VERSION}..."

if ! wget --quiet "${URL}" -O "${FILE}"; then
echo "[!!] DOMjudge version ${VERSION} file not found on https://codeload.github.com/DOMjudge/domjudge"
exit 1
fi
fi
Loading
Loading