mirror of
https://github.com/MeiK2333/river.git
synced 2025-11-04 14:49:40 +08:00
Update Dockerfile
This commit is contained in:
parent
e8f41cef28
commit
4aa21bce44
21
Dockerfile
21
Dockerfile
@ -1,3 +1,12 @@
|
||||
FROM rust:latest as builder
|
||||
|
||||
COPY . /river
|
||||
|
||||
WORKDIR /river
|
||||
|
||||
RUN rustup component add rustfmt --toolchain 1.47.0-x86_64-unknown-linux-gnu && \
|
||||
cargo build --release
|
||||
|
||||
FROM ubuntu:18.04
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
@ -12,3 +21,15 @@ RUN apt update && \
|
||||
RUN apt install -y curl && \
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
|
||||
ENV PATH=/root/.cargo/bin:$PATH
|
||||
|
||||
# TODO: install other languages
|
||||
|
||||
COPY ./plugins /plugins
|
||||
|
||||
RUN /plugins/build.sh
|
||||
|
||||
WORKDIR /river
|
||||
|
||||
COPY --from=builder /river/target/release/river /river/
|
||||
|
||||
CMD [ "river" ]
|
||||
|
||||
21
README.md
21
README.md
@ -6,30 +6,19 @@
|
||||
|
||||
## Example
|
||||
|
||||
```json
|
||||
{
|
||||
"language": 0,
|
||||
"judge_type": 0,
|
||||
"compile_data": {
|
||||
"code": "I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBtYWluKCkgewogIHByaW50ZigiSGVsbG8gV29ybGQhXG4iKTsKICByZXR1cm4gMDsKfQ=="
|
||||
},
|
||||
"judge_data": {
|
||||
"in_data": "SGVsbG8gV29ybGQh",
|
||||
"out_data": "SGVsbG8gV29ybGQh",
|
||||
"time_limit": 1000,
|
||||
"memory_limit": 65535
|
||||
}
|
||||
}
|
||||
```bash
|
||||
cd example
|
||||
python3 main.py
|
||||
```
|
||||
|
||||
## TODOs
|
||||
|
||||
已经完成基本功能,后续需要优化
|
||||
|
||||
- 基于 ptrace 的精准内存测量
|
||||
- <del>基于 ptrace 的精准内存测量</del>
|
||||
- 基于 cgroups 的资源控制
|
||||
- 用户、组限制
|
||||
- 示例代码
|
||||
- <del>示例代码</del>
|
||||
- 安全测试
|
||||
- 优化 args 生成代码,减少测量出的用户代码执行时间
|
||||
- special judge
|
||||
|
||||
12
plugins/build.sh
Normal file
12
plugins/build.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Hello World!"
|
||||
# create judge dir
|
||||
mkdir -p /river/runner
|
||||
|
||||
# add to path
|
||||
export PATH=$PATH:/plugins/js
|
||||
cd /plugins/js
|
||||
npm install
|
||||
|
||||
echo "Hello World!"
|
||||
Loading…
Reference in New Issue
Block a user