diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ba9e273 --- /dev/null +++ b/docker-compose.yml @@ -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" + + \ No newline at end of file diff --git a/docker/Dockerfile-backend b/docker/Dockerfile-backend new file mode 100644 index 0000000..58f68e7 --- /dev/null +++ b/docker/Dockerfile-backend @@ -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"]