mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 07:38:42 +00:00
feat: build s2oj-remote-judger image
This commit is contained in:
parent
2556dd7819
commit
66acf9dba5
30
.drone.yml
30
.drone.yml
@ -58,6 +58,36 @@ steps:
|
|||||||
event: push
|
event: push
|
||||||
branch: master
|
branch: master
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: Build Docker Image (s2oj-remote-judger)
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: tags
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags
|
||||||
|
|
||||||
|
- name: docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: git.m.ac
|
||||||
|
repo: git.m.ac/baoshuo/s2oj-remote-judger
|
||||||
|
context: remote_judger
|
||||||
|
dockerfile: remote_judger/Dockerfile
|
||||||
|
username: baoshuo
|
||||||
|
password:
|
||||||
|
from_secret: GITMAC_SECRET
|
||||||
|
cache_from: git.m.ac/baoshuo/s2oj-remote-judger:latest
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
|
branch: master
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
|
110
.github/workflows/build.yml
vendored
110
.github/workflows/build.yml
vendored
@ -3,9 +3,10 @@ name: Build & Push Docker Images
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- master
|
||||||
tags:
|
pull_request:
|
||||||
- 'v*'
|
branches:
|
||||||
|
- master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@ -13,88 +14,31 @@ env:
|
|||||||
IMAGE_BASENAME: ${{ github.repository }}
|
IMAGE_BASENAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-db:
|
build:
|
||||||
name: Build Database Image
|
name: Build Image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
strategy:
|
||||||
uses: docker/login-action@v2.0.0
|
matrix:
|
||||||
with:
|
include:
|
||||||
registry: ${{ env.REGISTRY }}
|
- image_name: db
|
||||||
username: ${{ github.actor }}
|
context: db
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
dockerfile: Dockerfile
|
||||||
|
- image_name: judger
|
||||||
|
context: judger
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
- image_name: remote-judger
|
||||||
|
context: remote_judger
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
- image_name: web
|
||||||
|
context: .
|
||||||
|
dockerfile: web/Dockerfile
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4.0.1
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASENAME }}-db
|
|
||||||
tags: |
|
|
||||||
latest
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=sha,prefix=
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v3.1.1
|
|
||||||
with:
|
|
||||||
context: db
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
||||||
build-judger:
|
|
||||||
name: Build Judger Image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2.0.0
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4.0.1
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASENAME }}-judger
|
|
||||||
tags: |
|
|
||||||
latest
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=sha,prefix=
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v3.1.1
|
|
||||||
with:
|
|
||||||
context: judger
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
||||||
build-web:
|
|
||||||
name: Build Web Image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -114,7 +58,7 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4.0.1
|
uses: docker/metadata-action@v4.0.1
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASENAME }}-web
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASENAME }}-${{ matrix.image_name }}
|
||||||
tags: |
|
tags: |
|
||||||
latest
|
latest
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
@ -126,8 +70,8 @@ jobs:
|
|||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v3.1.1
|
uses: docker/build-push-action@v3.1.1
|
||||||
with:
|
with:
|
||||||
context: .
|
context: ${{ matrix.context }}
|
||||||
file: web/Dockerfile
|
file: ${{ matrix.dockerfile }}
|
||||||
push: true
|
push: ${{ github.event_name == 'push' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
@ -50,8 +50,6 @@ services:
|
|||||||
- USE_MIRROR=1
|
- USE_MIRROR=1
|
||||||
container_name: uoj-remote-judger
|
container_name: uoj-remote-judger
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
|
||||||
- ./uoj_data/judger/log:/opt/uoj_judger/log
|
|
||||||
env_file:
|
env_file:
|
||||||
- remote-judger.development.env
|
- remote-judger.development.env
|
||||||
environment:
|
environment:
|
||||||
|
@ -29,6 +29,16 @@ services:
|
|||||||
- SOCKET_PORT=2333
|
- SOCKET_PORT=2333
|
||||||
- SOCKET_PASSWORD=_judger_socket_password_
|
- SOCKET_PASSWORD=_judger_socket_password_
|
||||||
|
|
||||||
|
uoj-remote-judger:
|
||||||
|
image: git.m.ac/baoshuo/s2oj-remote-judger
|
||||||
|
container_name: uoj-remote-judger
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- UOJ_PROTOCOL=http
|
||||||
|
- UOJ_HOST=uoj-web
|
||||||
|
- UOJ_JUDGER_NAME=remote_judger
|
||||||
|
- UOJ_JUDGER_PASSWORD=_judger_password_
|
||||||
|
|
||||||
uoj-web:
|
uoj-web:
|
||||||
image: git.m.ac/baoshuo/s2oj-web
|
image: git.m.ac/baoshuo/s2oj-web
|
||||||
container_name: uoj-web
|
container_name: uoj-web
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
USE `app_uoj233`;
|
USE `app_uoj233`;
|
||||||
insert into judger_info (judger_name, password, ip) values ('compose_judger', '_judger_password_', 'uoj-judger');
|
insert into judger_info (judger_name, password, ip, display_name, description) values ('compose_judger', '_judger_password_', 'uoj-judger', '内置评测机', '用于评测本地题目的评测机。');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM node:18
|
FROM node:18.13.0
|
||||||
|
|
||||||
WORKDIR /opt/s2oj_remote_judger
|
WORKDIR /opt/s2oj_remote_judger
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
USE `app_uoj233`;
|
USE `app_uoj233`;
|
||||||
insert into judger_info (judger_name, password, ip) values ('remote_judger', '_judger_password_', 'uoj-remote-judger');
|
insert into judger_info (judger_name, password, ip, display_name, description) values ('remote_judger', '_judger_password_', 'uoj-remote-judger', '远端评测机', '用于桥接远端 OJ 评测机的虚拟评测机。');
|
||||||
|
Loading…
Reference in New Issue
Block a user