Reduce build size

This commit is contained in:
criyle 2021-01-09 00:38:46 -08:00
parent 0db852c242
commit a0cc4acbe8
7 changed files with 20 additions and 9 deletions

View File

@ -35,10 +35,10 @@ jobs:
GOARCH:
- amd64
steps:
- name: Set up Go 1.14
- name: Set up Go 1.15
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.15
- name: Check out
uses: actions/checkout@v2
- name: Get git tag ref
@ -59,7 +59,7 @@ jobs:
GOARCH: ${{ matrix.GOARCH }}
run: |
go generate ./cmd/executorserver
go build -o executorserver ./cmd/executorserver
go build -tags nomsgpack -o executorserver ./cmd/executorserver
go build -o executorshell ./cmd/executorshell
- name: Build shared objects on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
@ -109,7 +109,7 @@ jobs:
GOARCH: ${{ matrix.GOARCH }}
run: |
go generate ./cmd/executorserver
go build -o executorserver.exe ./cmd/executorserver
go build -tags nomsgpack -o executorserver.exe ./cmd/executorserver
- name: Build shared object on Windows
if: ${{ matrix.os == 'windows-latest' }}
env:
@ -145,7 +145,7 @@ jobs:
GOARCH: ${{ matrix.GOARCH }}
run: |
go generate ./cmd/executorserver
go build -o executorserver ./cmd/executorserver
go build -tags nomsgpack -o executorserver ./cmd/executorserver
go build -o executorshell ./cmd/executorshell
- name: Build shared object on macOS
if: ${{ matrix.os == 'macos-latest' }}

View File

@ -11,7 +11,7 @@ RUN go mod download
COPY ./ /go/judge
RUN go build -o executorserver ./cmd/executorserver && \
RUN go build -tags nomsgpack -o executorserver ./cmd/executorserver && \
go build -o cinit ./cmd/cinit && \
go build -buildmode=c-shared -o executor_server.so ./cmd/ffi/

View File

@ -8,7 +8,7 @@ RUN go mod download
COPY ./ /go/judge
RUN go build -o executorserver ./cmd/executorserver \
RUN go build -tags nomsgpack -o executorserver ./cmd/executorserver \
&& go build -o cinit ./cmd/cinit \
&& go build -buildmode=c-shared -o executor_server.so ./cmd/ffi/

View File

@ -59,7 +59,7 @@ Sandbox:
- for example, by default container 0 will run with 10001 uid & gid and container 1 will run with 10002 uid & gid...
- `-enable-cpu-rate` enabled `cpu` cgroup to control cpu rate using cfs_quota & cfs_period control
- `-cpu-cfs-period` specifies cfs_period if cpu rate is enabled (default 100ms) (valid value: \[1ms, 1s\])
- `-seccomp-conf` specifies `seecomp` filter setting to load when running program
- `-seccomp-conf` specifies `seecomp` filter setting to load when running program (need build tag `seccomp`)
- for example, by `strace -c prog` to get all `syscall` needed and restrict to that sub set
- however, the `syscall` count in one platform(e.g. x86_64) is not suitable for all platform, so this option is not recommended
- the program killed by seccomp filter will have status `Dangerous Syscall`

9
env/noseccomp_linux.go vendored Normal file
View File

@ -0,0 +1,9 @@
// +build !seccomp
package env
import "syscall"
func readSeccompConf(name string) ([]syscall.SockFilter, error) {
return nil, nil
}

View File

@ -1,3 +1,5 @@
// +build seccomp
package env
import (

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/criyle/go-judge
go 1.14
go 1.15
require (
cloud.google.com/go v0.74.0 // indirect