Skip to content

build: streamline Dockerfile and bump deps #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
FROM python:3.7-buster
FROM python:3.9-slim

RUN pip install pipenv==2018.11.26
RUN pip install --upgrade pipenv

WORKDIR /app

COPY Pipfile /app
COPY Pipfile.lock /app
COPY . .
RUN pipenv install --system --deploy

COPY app.py /app

EXPOSE 8080

CMD ["gunicorn", "-b", ":8080", "--workers", "2", "--threads", "4", "--worker-class", "gthread", "--access-logfile", "-", "--error-logfile", "-", "app:app"]
ENTRYPOINT ["./entrypoint.sh"]
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[source]]
url = "https://pypi.python.org/simple"
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

Expand All @@ -10,4 +10,4 @@ gunicorn = "*"
[dev-packages]

[requires]
python_version = "3.7"
python_version = "3.9"
174 changes: 123 additions & 51 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

![last commit](https://flat.badgen.net/github/last-commit/sysdiglabs/security-playground?icon=github) ![licence](https://flat.badgen.net/github/license/sysdiglabs/security-playground) ![docker pulls](https://flat.badgen.net/docker/pulls/sysdiglabs/security-playground?icon=docker)

The security playground is a HTTP web server to simulate security breaches in
run time.
The security playground is an HTTP web server to simulate security breaches. It allows you to read, write, and execute commands in a containerized environment.

## Installation

Use the docker image to deploy it in your Kubernetes cluster or locally in a
container.
Deploy the docker image in your environment.

```bash
$ docker run --rm -p 8080:8080 sysdiglabs/security-playground
```

Setup the health check to the `/health` endpoint if required.


## Usage

The HTTP API exposes tree endpoints to interact with the system.
Expand All @@ -40,10 +41,10 @@ This will write to /bin/hello the hello-world string

### Executing a command

You can execute a command using the /exec endpoint and POSTing the command.
You can execute a command using the `/exec` endpoint and POSTing the command.

```bash
$ curl -X POST /exec -d 'command=ls -la'
$ curl -X POST localhost:8080/exec -d 'command=ls -la'
```

This will capture and return the STDOUT of the command executed.
This will capture and return the STDOUT of the executed command.
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

gunicorn -b :8080 --workers 2 --threads 4 --worker-class gthread --access-logfile - --error-logfile - app:app