diff --git a/.gitignore b/.gitignore index 2486c67..987f824 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/ Cargo.lock scripts/thirdparty/ -override.env \ No newline at end of file +override.env +problem-packages/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 419be48..8297f03 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,7 +13,7 @@ "serve" ], "stopAtEntry": false, - "cwd": "${workspaceFolder}/judger/workdirs/development", + "cwd": "${workspaceFolder}/judger/", "environment": [], "externalConsole": false, "MIMode": "gdb", diff --git a/Dockerfile b/Dockerfile index 1dfd368..829dc35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,10 +17,13 @@ RUN curl https://rclone.org/install.sh | bash RUN mkdir /workdir RUN mkdir /workdir/problem-package -COPY judger/workdirs/docker/ /workdir +COPY judger/.env /workdir/.env +COPY judger/rclone.conf /workdir/rclone.conf +RUN sed -i 's/127.0.0.1/host.docker.internal/g' /workdir/rclone.conf WORKDIR /workdir ENV RUST_LOG=DEBUG ENV PLATFORM_URI=http://host.docker.internal:8080/ +ENV ENABLE_RCLONE=true EXPOSE 8000 CMD [ "judger", "serve" ] \ No newline at end of file diff --git a/judger/workdirs/development/.env b/judger/.env similarity index 100% rename from judger/workdirs/development/.env rename to judger/.env diff --git a/judger/workdirs/development/override.example.env b/judger/override.example.env similarity index 50% rename from judger/workdirs/development/override.example.env rename to judger/override.example.env index 6da7b54..904e811 100644 --- a/judger/workdirs/development/override.example.env +++ b/judger/override.example.env @@ -1,6 +1,5 @@ # Description: This file is an example of the override.env file. # You can copy this file to override.env and modify the values to override the default values. -# In this example, we enable rclone and set the problem package path to rclone-problem-package. -ENABLE_RCLONE=true -PROBLEM_PACKAGE_PATH=rclone-problem-package \ No newline at end of file +# In this example, we enable rclone +ENABLE_RCLONE=true \ No newline at end of file diff --git a/judger/workdirs/development/rclone.conf b/judger/rclone.conf similarity index 100% rename from judger/workdirs/development/rclone.conf rename to judger/rclone.conf diff --git a/judger/src/option.rs b/judger/src/option.rs index c65c342..179cb1c 100644 --- a/judger/src/option.rs +++ b/judger/src/option.rs @@ -23,7 +23,7 @@ pub struct JudgerOpt { #[structopt(long, default_value = "oj-lab-problem-package")] pub problem_package_bucket: String, /// Where to store problem package - #[structopt(env = "PROBLEM_PACKAGE_PATH", default_value = "problem-package")] + #[structopt(env = "PROBLEM_PACKAGE_PATH", default_value = "problem-packages")] pub problem_package_dir: PathBuf, } diff --git a/judger/workdirs/development/.gitignore b/judger/workdirs/development/.gitignore deleted file mode 100644 index 2563f7d..0000000 --- a/judger/workdirs/development/.gitignore +++ /dev/null @@ -1 +0,0 @@ -rclone-problem-package/ diff --git a/judger/workdirs/development/problem-package/hello-world/.timelimit b/judger/workdirs/development/problem-package/hello-world/.timelimit deleted file mode 100644 index d00491f..0000000 --- a/judger/workdirs/development/problem-package/hello-world/.timelimit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/judger/workdirs/development/problem-package/hello-world/ans.cpp b/judger/workdirs/development/problem-package/hello-world/ans.cpp deleted file mode 100644 index 2011519..0000000 --- a/judger/workdirs/development/problem-package/hello-world/ans.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -using namespace std; - -int main() { - string s; - cin >> s; - cout << "Hello! " << s << endl; -} diff --git a/judger/workdirs/development/problem-package/hello-world/data/secret/0.ans b/judger/workdirs/development/problem-package/hello-world/data/secret/0.ans deleted file mode 100644 index 2a1588e..0000000 --- a/judger/workdirs/development/problem-package/hello-world/data/secret/0.ans +++ /dev/null @@ -1 +0,0 @@ -Hello! world! diff --git a/judger/workdirs/development/problem-package/hello-world/data/secret/0.in b/judger/workdirs/development/problem-package/hello-world/data/secret/0.in deleted file mode 100644 index c944ebc..0000000 --- a/judger/workdirs/development/problem-package/hello-world/data/secret/0.in +++ /dev/null @@ -1 +0,0 @@ -world! \ No newline at end of file diff --git a/judger/workdirs/development/problem-package/hello-world/data/secret/1.ans b/judger/workdirs/development/problem-package/hello-world/data/secret/1.ans deleted file mode 100644 index fb35721..0000000 --- a/judger/workdirs/development/problem-package/hello-world/data/secret/1.ans +++ /dev/null @@ -1 +0,0 @@ -Hello! oj-lab! diff --git a/judger/workdirs/development/problem-package/hello-world/data/secret/1.in b/judger/workdirs/development/problem-package/hello-world/data/secret/1.in deleted file mode 100644 index 893a717..0000000 --- a/judger/workdirs/development/problem-package/hello-world/data/secret/1.in +++ /dev/null @@ -1 +0,0 @@ -oj-lab! \ No newline at end of file diff --git a/judger/workdirs/development/problem-package/hello-world/output_validators/interactor-a-plus-b b/judger/workdirs/development/problem-package/hello-world/output_validators/interactor-a-plus-b deleted file mode 100644 index c237a18..0000000 Binary files a/judger/workdirs/development/problem-package/hello-world/output_validators/interactor-a-plus-b and /dev/null differ diff --git a/judger/workdirs/development/problem-package/hello-world/output_validators/lcmp b/judger/workdirs/development/problem-package/hello-world/output_validators/lcmp deleted file mode 100644 index 786b861..0000000 Binary files a/judger/workdirs/development/problem-package/hello-world/output_validators/lcmp and /dev/null differ diff --git a/judger/workdirs/development/problem-package/hello-world/output_validators/ncmp b/judger/workdirs/development/problem-package/hello-world/output_validators/ncmp deleted file mode 100644 index 8711c86..0000000 Binary files a/judger/workdirs/development/problem-package/hello-world/output_validators/ncmp and /dev/null differ diff --git a/judger/workdirs/development/problem-package/hello-world/problem.yaml b/judger/workdirs/development/problem-package/hello-world/problem.yaml deleted file mode 100644 index 89fe447..0000000 --- a/judger/workdirs/development/problem-package/hello-world/problem.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: Hello world - -limits: - time_multiplier: 5 - time_safety_margin: 2 - memory: 2048 - output: 8 - code: 128 - compilation_time: 60 - compilation_memory: 2048 - validation_time: 60 - validation_memory: 2048 - validation_output: 8 diff --git a/judger/workdirs/docker/problem-package/hello-world/.timelimit b/judger/workdirs/docker/problem-package/hello-world/.timelimit deleted file mode 100644 index d00491f..0000000 --- a/judger/workdirs/docker/problem-package/hello-world/.timelimit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/judger/workdirs/docker/problem-package/hello-world/ans.cpp b/judger/workdirs/docker/problem-package/hello-world/ans.cpp deleted file mode 100644 index 2011519..0000000 --- a/judger/workdirs/docker/problem-package/hello-world/ans.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -using namespace std; - -int main() { - string s; - cin >> s; - cout << "Hello! " << s << endl; -} diff --git a/judger/workdirs/docker/problem-package/hello-world/data/secret/0.ans b/judger/workdirs/docker/problem-package/hello-world/data/secret/0.ans deleted file mode 100644 index 2a1588e..0000000 --- a/judger/workdirs/docker/problem-package/hello-world/data/secret/0.ans +++ /dev/null @@ -1 +0,0 @@ -Hello! world! diff --git a/judger/workdirs/docker/problem-package/hello-world/data/secret/0.in b/judger/workdirs/docker/problem-package/hello-world/data/secret/0.in deleted file mode 100644 index c944ebc..0000000 --- a/judger/workdirs/docker/problem-package/hello-world/data/secret/0.in +++ /dev/null @@ -1 +0,0 @@ -world! \ No newline at end of file diff --git a/judger/workdirs/docker/problem-package/hello-world/data/secret/1.ans b/judger/workdirs/docker/problem-package/hello-world/data/secret/1.ans deleted file mode 100644 index fb35721..0000000 --- a/judger/workdirs/docker/problem-package/hello-world/data/secret/1.ans +++ /dev/null @@ -1 +0,0 @@ -Hello! oj-lab! diff --git a/judger/workdirs/docker/problem-package/hello-world/data/secret/1.in b/judger/workdirs/docker/problem-package/hello-world/data/secret/1.in deleted file mode 100644 index 893a717..0000000 --- a/judger/workdirs/docker/problem-package/hello-world/data/secret/1.in +++ /dev/null @@ -1 +0,0 @@ -oj-lab! \ No newline at end of file diff --git a/judger/workdirs/docker/problem-package/hello-world/output_validators/interactor-a-plus-b b/judger/workdirs/docker/problem-package/hello-world/output_validators/interactor-a-plus-b deleted file mode 100644 index c237a18..0000000 Binary files a/judger/workdirs/docker/problem-package/hello-world/output_validators/interactor-a-plus-b and /dev/null differ diff --git a/judger/workdirs/docker/problem-package/hello-world/output_validators/lcmp b/judger/workdirs/docker/problem-package/hello-world/output_validators/lcmp deleted file mode 100644 index 786b861..0000000 Binary files a/judger/workdirs/docker/problem-package/hello-world/output_validators/lcmp and /dev/null differ diff --git a/judger/workdirs/docker/problem-package/hello-world/output_validators/ncmp b/judger/workdirs/docker/problem-package/hello-world/output_validators/ncmp deleted file mode 100644 index 8711c86..0000000 Binary files a/judger/workdirs/docker/problem-package/hello-world/output_validators/ncmp and /dev/null differ diff --git a/judger/workdirs/docker/problem-package/hello-world/problem.yaml b/judger/workdirs/docker/problem-package/hello-world/problem.yaml deleted file mode 100644 index 89fe447..0000000 --- a/judger/workdirs/docker/problem-package/hello-world/problem.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: Hello world - -limits: - time_multiplier: 5 - time_safety_margin: 2 - memory: 2048 - output: 8 - code: 128 - compilation_time: 60 - compilation_memory: 2048 - validation_time: 60 - validation_memory: 2048 - validation_output: 8 diff --git a/judger/workdirs/docker/rclone.conf b/judger/workdirs/docker/rclone.conf deleted file mode 100644 index b35e71b..0000000 --- a/judger/workdirs/docker/rclone.conf +++ /dev/null @@ -1,9 +0,0 @@ -[minio] -type = s3 -provider = Minio -env_auth = false -access_key_id = minio-root-user -secret_access_key = minio-root-password -endpoint = http://host.docker.internal:9000 -location_constraint = -acl = private \ No newline at end of file