mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
Add demo Dockerfile
This commit is contained in:
parent
8e8cc17123
commit
0234395b50
24
.dockerignore
Normal file
24
.dockerignore
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
/judge
|
||||||
|
|
||||||
|
# Test binary, build with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Test Env
|
||||||
|
env*.sh
|
||||||
|
init.sql
|
||||||
|
|
||||||
|
# Documents
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
13
Dockerfile.exec
Normal file
13
Dockerfile.exec
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM golang:latest AS build
|
||||||
|
|
||||||
|
WORKDIR /go/judge
|
||||||
|
|
||||||
|
COPY go.mod go.sum /go/judge/
|
||||||
|
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY ./ /go/judge
|
||||||
|
|
||||||
|
RUN go build -o executorserver ./cmd/executorserver
|
||||||
|
|
||||||
|
ENTRYPOINT ["./executorserver"]
|
||||||
@ -27,6 +27,14 @@ go get github.com/criyle/go-judge/cmd/executorserver
|
|||||||
~/go/bin/executorserver # or executorserver if $(GOPATH)/bin is in your $PATH
|
~/go/bin/executorserver # or executorserver if $(GOPATH)/bin is in your $PATH
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or, by docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -it --rm --privileged -p 5050:5050 criyle/executorserver:demo
|
||||||
|
```
|
||||||
|
|
||||||
|
Build by your own `docker build -t executorserver -f Dockerfile.exec .`
|
||||||
|
|
||||||
The `executorserver` need root privilege to create `cgroup`. Either creates sub-directory `/sys/fs/cgroup/cpuacct/go-judger`, `/sys/fs/cgroup/memory/go-judger`, `/sys/fs/cgroup/pids/go-judger` and make execution user readable or use `sudo` to run it.
|
The `executorserver` need root privilege to create `cgroup`. Either creates sub-directory `/sys/fs/cgroup/cpuacct/go-judger`, `/sys/fs/cgroup/memory/go-judger`, `/sys/fs/cgroup/pids/go-judger` and make execution user readable or use `sudo` to run it.
|
||||||
|
|
||||||
The default binding address for the executor server is `:5050`. Can be specified with `-http` flag.
|
The default binding address for the executor server is `:5050`. Can be specified with `-http` flag.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user