diff options
author | 2018-05-22 23:00:05 +0200 | |
---|---|---|
committer | 2018-05-22 23:00:05 +0200 | |
commit | 6f253e8f8ac56f70582853eb8fd2b39d07fa1b34 (patch) | |
tree | d57a8f869648fb77ea427c33f197b9c68b2bd58e | |
parent | adds webapp and docker-compose for more proof of concept (diff) |
puts the webapp in a docker container and puts it in docker-compose
-rw-r--r-- | Pipfile | 3 | ||||
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | docker-compose.yml | 13 | ||||
-rw-r--r-- | docker/Dockerfile.webapp | 25 |
4 files changed, 43 insertions, 12 deletions
@@ -19,6 +19,7 @@ python_version = "3.6" [scripts] consume = "python consume.py" publish = "python publish.py" +webapp = "python webapp.py" build = "docker build -t pythondiscord/snekbox:latest -f docker/Dockerfile ." +buildwebapp = "docker build -t pythondiscord/snekboxweb:latest -f docker/Dockerfile.webapp ." compose = "docker-compose up" -webapp = "PYTHONPATH=/vagrant/discord-python/snekbox python webapp/webapp.py" @@ -58,20 +58,12 @@ pipenv run python runner/publish.py ## Docker compose -Start both rabbitmq and a consumer with docker-compose +Start all the containers with docker-compose ```bash docker-compose up ``` -## Try the webapp +this boots up rabbitmq, the snekbox and a webinterface on port 5000 -After getting docker-compose to run the rabbitmq server and the consumer - -try running the webapp in another terminal - -```bash -pipenv run python webapp/webapp.py -``` - -and then open up the page: http://localhost:5000 (or whatever address it's running on) +`http://localhost:5000` diff --git a/docker-compose.yml b/docker-compose.yml index 11dad71..667a700 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,5 +14,18 @@ services: environment: RMQ_HOST: pdrmq + pdsnekboxweb: + hostname: "pdsnekboxweb" + image: pythondiscord/snekboxweb:latest + networks: + - sneknet + ports: + - "5000:5000" + expose: + - "5000" + environment: + RMQ_HOST: pdrmq + + networks: sneknet: diff --git a/docker/Dockerfile.webapp b/docker/Dockerfile.webapp new file mode 100644 index 0000000..ea06f20 --- /dev/null +++ b/docker/Dockerfile.webapp @@ -0,0 +1,25 @@ +FROM python:3.6-alpine3.7 + +RUN apk add --update tini +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=/webapp + +RUN pip install pipenv + +RUN mkdir -p /webapp +COPY Pipfile /webapp +COPY Pipfile.lock /webapp +COPY webapp /webapp +WORKDIR /webapp + +RUN pipenv sync --dev + +EXPOSE 5000 + +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["pipenv", "run", "webapp"] |