From ce0c47821f9270c1cdf4706f3cc8ee243a174149 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 19 Sep 2022 16:48:45 +0800 Subject: [PATCH] feat: prod docker compose config --- README.md | 25 ++++++++++++-- docker-compose.development.yml | 61 ++++++++++++++++++++++++++++++++++ docker-compose.yml | 13 ++------ 3 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 docker-compose.development.yml diff --git a/README.md b/README.md index bdd638b..a77661f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Logo +Logo # S2OJ @@ -17,10 +17,29 @@ ## 文档 -有关安装、管理、维护,可参阅:[https://universaloj.github.io/](https://universaloj.github.io/) +有关安装、管理、维护,可参阅:[https://universaloj.github.io/](https://universaloj.github.io/) 和 [https://vfleaking.github.io/uoj/](https://vfleaking.github.io/uoj/)。 + +## 部署 + +```bash +docker-compose up -d +``` + +更新: + +```bash +docker-compose pull +docker-compose up -d +``` + +## 开发 + +```bash +docker-compose up --build -f docker-compose.development.yml +``` ## 感谢 -- [vfleaking](https://github.com/vfleaking) 将 UOJ 代码[开源](https://github.com/vfleaking/uoj) +- [vfleaking](https://github.com/vfleaking) 将 UOJ 代码 [开源](https://github.com/vfleaking/uoj) - 向原项目或本项目贡献代码的人 - 给我们启发与灵感以及提供意见和建议的人 diff --git a/docker-compose.development.yml b/docker-compose.development.yml new file mode 100644 index 0000000..3b8e34f --- /dev/null +++ b/docker-compose.development.yml @@ -0,0 +1,61 @@ +version: "3" +services: + uoj-db: + 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: + 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: + 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 + - ./uoj_data/web/storage:/opt/uoj/web/app/storage + ports: + - "80:80" + 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 diff --git a/docker-compose.yml b/docker-compose.yml index 4283134..7bbf999 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,7 @@ version: "3" services: - uoj-db: - build: - context: ./db/ - dockerfile: Dockerfile + image: git.m.ac/baoshuo/s2oj-db container_name: uoj-db restart: always volumes: @@ -14,9 +11,7 @@ services: - MYSQL_ROOT_PASSWORD=root uoj-judger: - build: - context: ./judger/ - dockerfile: Dockerfile + image: git.m.ac/baoshuo/s2oj-judger container_name: uoj-judger restart: always stdin_open: true @@ -34,9 +29,7 @@ services: - SOCKET_PASSWORD=_judger_socket_password_ uoj-web: - build: - context: ./ - dockerfile: web/Dockerfile + image: git.m.ac/baoshuo/s2oj-web container_name: uoj-web restart: always stdin_open: true