-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from UniversalOJ/docker-compose
变更 Docker 镜像发布方式
- Loading branch information
Showing
19 changed files
with
280 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.github/ | ||
.git/ | ||
|
||
uoj_data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Build & Push Docker Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_BASENAME: uoj | ||
|
||
jobs: | ||
build: | ||
name: Build Image | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- image_name: db | ||
context: db | ||
dockerfile: db/Dockerfile | ||
- image_name: judger | ||
context: judger | ||
dockerfile: judger/Dockerfile | ||
- image_name: web | ||
context: . | ||
dockerfile: web/Dockerfile | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASENAME }}-${{ matrix.image_name }} | ||
tags: | | ||
latest | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=sha,prefix= | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: ${{ matrix.context }} | ||
file: ${{ matrix.dockerfile }} | ||
push: ${{ github.event_name == 'push' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
uoj_data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM mysql:5.7 | ||
MAINTAINER Baoshuo <[email protected]> | ||
LABEL org.opencontainers.image.source=https://github.com/UniversalOJ/UOJ-System | ||
LABEL org.opencontainers.image.description="UOJ Database" | ||
LABEL org.opencontainers.image.licenses=MIT | ||
|
||
ADD . /opt/uoj_db | ||
WORKDIR /opt/uoj_db | ||
|
||
RUN sh install.sh | ||
|
||
ENV LANG=C.UTF-8 TZ=Asia/Shanghai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
USE `app_uoj233`; | ||
insert into judger_info (judger_name, password) values ('compose_judger', '_judger_password_'); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
version: '3' | ||
|
||
services: | ||
uoj-db: | ||
image: ghcr.io/UniversalOJ/uoj-db:latest | ||
build: | ||
context: ./db/ | ||
dockerfile: Dockerfile | ||
container_name: uoj-db | ||
restart: always | ||
volumes: | ||
- ./uoj_data/db/mysql:/var/lib/mysql | ||
environment: | ||
- MYSQL_DATABASE=app_uoj233 | ||
- MYSQL_ROOT_PASSWORD=root | ||
|
||
uoj-judger: | ||
image: ghcr.io/UniversalOJ/uoj-judger:latest | ||
build: | ||
context: ./judger/ | ||
dockerfile: Dockerfile | ||
container_name: uoj-judger | ||
restart: always | ||
stdin_open: true | ||
tty: true | ||
cap_add: | ||
- SYS_PTRACE | ||
volumes: | ||
- ./uoj_data/judger/log:/opt/uoj_judger/log | ||
environment: | ||
- UOJ_PROTOCOL=http | ||
- UOJ_HOST=uoj-web | ||
- JUDGER_NAME=compose_judger | ||
- JUDGER_PASSWORD=_judger_password_ | ||
- SOCKET_PORT=2333 | ||
- SOCKET_PASSWORD=_judger_socket_password_ | ||
|
||
uoj-web: | ||
image: ghcr.io/UniversalOJ/uoj-web:latest | ||
build: | ||
context: ./ | ||
dockerfile: web/Dockerfile | ||
container_name: uoj-web | ||
restart: always | ||
stdin_open: true | ||
tty: true | ||
cap_add: | ||
- SYS_PTRACE | ||
depends_on: | ||
- uoj-db | ||
- uoj-judger | ||
volumes: | ||
- ./uoj_data/web/data:/var/uoj_data | ||
ports: | ||
- "80:80" | ||
- "3690:3690" | ||
environment: | ||
- DATABASE_HOST=uoj-db | ||
- DATABASE_PASSWORD=root | ||
- JUDGER_SOCKET_PORT=2333 | ||
- JUDGER_SOCKET_PASSWORD=_judger_socket_password_ | ||
- SALT_0=_salt_0_ | ||
- SALT_1=_salt_1_ | ||
- SALT_2=_salt_2_ | ||
- SALT_3=_salt_3_ | ||
- UOJ_PROTOCOL=http |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.