Skip to content

Commit

Permalink
minimal setup
Browse files Browse the repository at this point in the history
  • Loading branch information
phschiele committed Feb 16, 2021
1 parent babfc17 commit 7ffd1b0
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 89 deletions.
24 changes: 10 additions & 14 deletions .dockerignore
@@ -1,15 +1,11 @@
#https://stackoverflow.com/questions/28097064/dockerignore-ignore-everything-except-a-file-and-the-dockerfile
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Ignore Everything
**

!pypfopt
!tests
!setup.py
!README.md
!requirements.txt
!binder
!cookbook

**/__pycache__
**/*.pyc
*/__pycache__
*/*.pyc
9 changes: 9 additions & 0 deletions .gitignore
Expand Up @@ -11,6 +11,15 @@ DEV/
.pytest_cache/
.vscode/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

pip-selfcheck.json

html-coverage
Expand Down
42 changes: 22 additions & 20 deletions Dockerfile
@@ -1,26 +1,28 @@
FROM python:3.7.7-slim-stretch as builder
FROM python:3.8-slim-buster

# this will be user root regardless whether home/beakerx is not
COPY . /tmp/pypfopt
WORKDIR pypfopt
COPY pyproject.toml poetry.lock ./

RUN buildDeps='gcc g++' && \
apt-get update && apt-get install -y $buildDeps --no-install-recommends && \
pip install --no-cache-dir -r /tmp/pypfopt/requirements.txt && \
# One could install the pypfopt library directly in the image. We don't and share via docker-compose instead.
# pip install --no-cache-dir /tmp/pyhrp && \
rm -r /tmp/pypfopt && \
pip install --upgrade pip==21.0.1 && \
pip install "poetry==1.1.4" && \
poetry install -E optionals --no-root && \
apt-get purge -y --auto-remove $buildDeps


# ----------------------------------------------------------------------------------------------------------------------
FROM builder as test

# COPY tools needed for testing into the image
RUN pip install --no-cache-dir pytest pytest-cov pytest-html

# COPY the tests over
COPY tests /pypfopt/tests

WORKDIR /pypfopt

CMD py.test --cov=pypfopt --cov-report html:artifacts/html-coverage --cov-report term --html=artifacts/html-report/report.html tests
COPY . .

# Usage examples:
#
# Build
# docker build . -t pypfopt
#
# Run
# iPython interpreter:
# docker run -it pypfopt poetry run ipython
# Jupyter notebook server:
# docker run -it -p 8888:8888 pypfopt poetry run jupyter notebook --allow-root --no-browser --ip 0.0.0.0
# Pytest
# docker run -t pypfopt poetry run pytest
# Bash
# docker run -it pypfopt bash
20 changes: 0 additions & 20 deletions binder/Dockerfile

This file was deleted.

7 changes: 0 additions & 7 deletions binder/jupyter_notebook_config.py

This file was deleted.

12 changes: 0 additions & 12 deletions docker-compose.test.yml

This file was deleted.

16 changes: 0 additions & 16 deletions docker-compose.yml

This file was deleted.

0 comments on commit 7ffd1b0

Please sign in to comment.