Skip to content

Commit

Permalink
Add privileged flags where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Brikaa committed Sep 6, 2024
1 parent b3cc3c1 commit 6b02d12
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build
docker pull docker.pkg.github.com/engineer-man/piston/api
docker build -t piston-api api
docker run --network container:repo -v $(pwd)'/data:/piston' -e PISTON_LOG_LEVEL=DEBUG -e 'PISTON_REPO_URL=http://localhost:8000/index' -d --name api piston-api
docker run --privileged --network container:repo -v $(pwd)'/data:/piston' -e PISTON_LOG_LEVEL=DEBUG -e 'PISTON_REPO_URL=http://localhost:8000/index' -d --name api piston-api
echo Waiting for API to start..
docker run --network container:api appropriate/curl -s --retry 10 --retry-connrefused http://localhost:2000/api/v2/runtimes
Expand Down
7 changes: 4 additions & 3 deletions builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ fetch_packages(){
mkdir build
# Start a piston container
docker run \
--privileged \
-v "$PWD/build":'/piston/packages' \
--tmpfs /piston/jobs \
-dit \
-p $port:2000 \
--name builder_piston_instance \
ghcr.io/engineer-man/piston

# Ensure the CLI is installed
cd ../cli
npm i
cd -

# Evalulate the specfile
../cli/index.js -u "http://127.0.0.1:$port" ppman spec $1
../cli/index.js -u "http://127.0.0.1:$port" ppman spec $1
}

build_container(){
Expand All @@ -61,4 +62,4 @@ fetch_packages $SPEC_FILE
build_container $TAG

echo "Start your custom piston container with"
echo "$ docker run --tmpfs /piston/jobs -dit -p 2000:2000 $TAG"
echo "$ docker run --privileged --tmpfs /piston/jobs -dit -p 2000:2000 $TAG"
6 changes: 4 additions & 2 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ services:
- 2000:2000
volumes:
- ./data/piston/packages:/piston/packages
environment:
- PISTON_REPO_URL=http://repo:8000/index
tmpfs:
- /piston/jobs:exec,uid=1000,gid=1000,mode=711
environment:
- PISTON_DISABLE_NETWORKING=false
- PISTON_RUN_CPU_TIME=1000
- PISTON_LIMIT_OVERRIDES={"c++":{"run_cpu_time":700}}

repo: # Local testing of packages
build: repo
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ The API will now be online with no language runtimes installed. To install runti

```sh
docker run \
--privileged \
-v $PWD:'/piston' \
--tmpfs /piston/jobs \
-dit \
Expand Down

0 comments on commit 6b02d12

Please sign in to comment.