Skip to content

Commit

Permalink
Add docker composition for backend
Browse files Browse the repository at this point in the history
  • Loading branch information
spelhate committed May 26, 2020
1 parent c75550e commit 0ce5193
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3'
volumes:
reports:

services:

# Select between the next 2 services the backend you want to use by
# commenting / uncommenting the 'volume' section & modify the links alias
# on the mviewer-studio service.
#
# You cannot use both backends at the same time, and you have to be wary if
# you switch from one to another, as each comes with a custom config.json
# file.
#
# If you want to switch, make sure either you modify the config.json, or
# reinitialize the docker volume.


# Python version
mreport-backend:
build:
context: .
dockerfile: docker/Dockerfile-backend
image: mreport/mreport:python-latest
volumes:
- "reports:/home/apprunner/backend/reports"


23 changes: 23 additions & 0 deletions docker/Dockerfile-backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:3.7-slim

RUN useradd -r -m apprunner

USER apprunner

ENV HOME=/home/apprunner
ENV PATH=$HOME/.local/bin:$PATH

WORKDIR /home/apprunner

COPY requirements.txt .
COPY config.py .
RUN pip install --user -r requirements.txt

COPY --chown=apprunner:apprunner backend backend
RUN pip install --user backend && pip install --user gunicorn


VOLUME [ "/home/apprunner/backend/reports" ]


CMD ["gunicorn", "-w 4", "-b 0.0.0.0:8000", "backend:app"]

0 comments on commit 0ce5193

Please sign in to comment.