Update Dockerfile

This commit is contained in:
MeiK 2020-10-29 11:39:44 +08:00
parent e8f41cef28
commit 4aa21bce44
3 changed files with 38 additions and 16 deletions

View File

@ -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" ]

View File

@ -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
View 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!"