Skip to content

Commit f2839d1

Browse files
committed
Fix container_runtime
1 parent b03c2ee commit f2839d1

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

services/app/Dockerfile.runner

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,17 @@ ENV DOCKER_VERSION 24.0.9
3131
ENV NERDCTL_VERSION 2.1.3
3232
ENV GOON_VERSION v1.1.1
3333

34-
RUN apk update && apk add --no-cache ca-certificates git make curl vim
34+
RUN apk update && apk add --no-cache \
35+
podman \
36+
iptables \
37+
fuse-overlayfs \
38+
shadow \
39+
slirp4netns \
40+
ca-certificates \
41+
git \
42+
make \
43+
curl \
44+
vim
3545

3646
RUN curl -fsSL "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" \
3747
| tar -xzC /usr/local/bin --strip=1 docker/docker

services/app/apps/runner/lib/runner/executor.ex

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ defmodule Runner.Executor do
77
alias Runner.Languages
88

99
@tmp_basedir "/tmp/codebattle-runner"
10-
@docker_cmd_template "docker run --rm --init --memory 600m --cpus=2 --net none -l codebattle_game ~s ~s timeout -s KILL ~s make --silent test"
11-
@nerdctl_cmd_template "nerdctl run --rm --runtime=io.containerd.runc.v2 --memory 600m --cpus=2 --net none -l codebattle_game ~s ~s timeout -s KILL ~s make --silent test"
10+
@container_cmd_template "run --rm --init --memory 600m --cpus=2 --net none -l codebattle_game ~s ~s timeout -s KILL ~s make --silent test"
1211

1312
@fake_docker_run Application.compile_env(:runner, :fake_docker_run, false)
1413

@@ -98,11 +97,7 @@ defmodule Runner.Executor do
9897
Logger.info("Docker volume: #{inspect(volume)}")
9998

10099
cmd_template =
101-
if Application.get_env(:runner, :container_runtime) == "docker" do
102-
@docker_cmd_template
103-
else
104-
@nerdctl_cmd_template
105-
end
100+
Application.get_env(:runner, :container_runtime) <> " " <> @container_cmd_template
106101

107102
cmd_template
108103
|> :io_lib.format([volume, lang_meta.docker_image, lang_meta.container_run_timeout])

services/app/config/config.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,6 @@ config :runner, pull_docker_images: false
155155
config :runner, runner_container_killer: false
156156
config :runner, runner_cpu_logger: false
157157
config :runner, white_list_lang_slugs: []
158+
config :runner, container_runtime: "docker"
158159

159160
import_config "#{Mix.env()}.exs"

0 commit comments

Comments
 (0)