diff options
author | 2018-06-05 20:55:56 +0200 | |
---|---|---|
committer | 2018-06-05 20:55:56 +0200 | |
commit | 2eee1d50fd2b9ad1e938a3b2186a6c1874f30e42 (patch) | |
tree | 55cd90979cf25f52808be25de50d9a8221ebcaa9 | |
parent | Update README.md (diff) |
CI
-rw-r--r-- | .gitlab-ci.yml | 14 | ||||
-rw-r--r-- | .travis.yml | 43 | ||||
-rw-r--r-- | Pipfile | 6 | ||||
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | docker/Dockerfile | 19 | ||||
-rw-r--r-- | docker/base.Dockerfile | 23 |
6 files changed, 36 insertions, 76 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8183d8..28e16d5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: python:3.6-alpine3.7 +image: pythondiscord/snekbox-base:latest variables: DOCKER_DRIVER: overlay @@ -9,16 +9,10 @@ services: stages: - build -variables: - PIPENV_VENV_IN_PROJECT: 1 - PIPENV_IGNORE_VIRTUALENVS: 1 - PIPENV_NOSPIN: 1 - PIPENV_HIDE_EMOJIS: 1 - - build: stage: build script: - - pip install pipenv - - pipenv sync + - chmod +x scripts/ci.sh + - bash scripts/ci.sh - pipenv run lint + - pipenv run test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ddfc5f0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -language: python -python: - - "3.6" - -branches: - only: - - "master" - -dist: xenial -sudo: required - -services: - - rabbitmq - #- docker - -before_install: - - sudo apt-get update - - sudo apt-get install -y libprotobuf-dev libstdc++6 - - sudo su - -env: - global: - - PIPENV_VENV_IN_PROJECT=1 - - PIPENV_IGNORE_VIRTUALENVS=1 - - PIPENV_NOSPIN=1 - - PIPENV_HIDE_EMOJIS=1 - - RABBITMQ_HOST=localhost - -install: - - pip install pipenv - - pipenv sync --dev --three -script: - - chmod +x scripts/ci.sh - - bash scripts/ci.sh - - pipenv run lint - - pipenv run test -#after_success: -# - bash scripts/deploy.sh - -cache: pip - -notifications: - email: false @@ -25,9 +25,13 @@ python_version = "3.6" lint = "flake8" test = "py.test tests --cov . --cov-report term-missing -v" report = "py.test tests --cov . --cov-report=html" + snekbox = "python snekbox.py" snekweb = "gunicorn -w 2 -b 0.0.0.0:5000 --log-level debug -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker snekweb:app" + buildbox = "docker build -t pythondiscord/snekbox:latest -f docker/Dockerfile ." -buildweb = "docker build -t pythondiscord/snekboxweb:latest -f docker/Dockerfile.webapp ." pushbox = "docker push pythondiscord/snekbox:latest" +pushboxbase = "docker push pythondiscord/snekbox-base:latest" + +buildweb = "docker build -t pythondiscord/snekboxweb:latest -f docker/Dockerfile.webapp ." pushweb = "docker push pythondiscord/snekboxweb:latest" @@ -1,10 +1,7 @@ -| CI | STATUS | -|----|--------| -| GITLAB | [](https://gitlab.com/discord-python/projects/snekbox/commits/master) | -| TRAVIS | [](https://travis-ci.com/discord-python/snekbox) | - +[](https://gitlab.com/discord-python/projects/snekbox/commits/master) [](https://gitlab.com/discord-python/projects/snekbox/commits/master) # snekbox + Python sandbox runners for executing code in isolation aka snekbox The user sends a piece of python code to a snekbox, the snekbox executes the code and sends the result back to the users. diff --git a/docker/Dockerfile b/docker/Dockerfile index 2c707a1..e8fa8a5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,25 +1,10 @@ -FROM python:3.6-alpine3.7 - -RUN apk add --no-cache libstdc++ protobuf -RUN apk add --update build-base - -ENV PIPENV_VENV_IN_PROJECT=1 -ENV PIPENV_IGNORE_VIRTUALENVS=1 -ENV PIPENV_NOSPIN=1 -ENV PIPENV_HIDE_EMOJIS=1 -ENV PYTHONPATH=/snekbox - -RUN pip install pipenv +FROM pythondiscord/snekbox-base:latest RUN mkdir -p /snekbox -COPY Pipfile /snekbox -COPY Pipfile.lock /snekbox COPY . /snekbox WORKDIR /snekbox +RUN pipenv --rm RUN pipenv sync -RUN cp binaries/nsjail2.5-alpine-x86_64 /usr/sbin/nsjail -RUN chmod +x /usr/sbin/nsjail - CMD ["pipenv", "run", "snekbox"] diff --git a/docker/base.Dockerfile b/docker/base.Dockerfile new file mode 100644 index 0000000..ad2b7a1 --- /dev/null +++ b/docker/base.Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.6-alpine3.7 + +RUN apk add --no-cache libstdc++ protobuf +RUN apk add --update build-base + +ENV PIPENV_VENV_IN_PROJECT=1 +ENV PIPENV_IGNORE_VIRTUALENVS=1 +ENV PIPENV_NOSPIN=1 +ENV PIPENV_HIDE_EMOJIS=1 +ENV PYTHONPATH=/snekbox + +RUN pip install pipenv + +RUN mkdir -p /snekbox +COPY Pipfile /snekbox +COPY Pipfile.lock /snekbox +COPY . /snekbox +WORKDIR /snekbox + +RUN pipenv sync --dev + +RUN cp binaries/nsjail2.5-alpine-x86_64 /usr/sbin/nsjail +RUN chmod +x /usr/sbin/nsjail |