|
1 | | -FROM python:3.7.7-slim-stretch as builder |
| 1 | +FROM python:3.8-slim-buster |
2 | 2 |
|
3 | | -# this will be user root regardless whether home/beakerx is not |
4 | | -COPY . /tmp/pypfopt |
| 3 | +WORKDIR pypfopt |
| 4 | +COPY pyproject.toml poetry.lock ./ |
5 | 5 |
|
6 | 6 | RUN buildDeps='gcc g++' && \ |
7 | 7 | apt-get update && apt-get install -y $buildDeps --no-install-recommends && \ |
8 | | - pip install --no-cache-dir -r /tmp/pypfopt/requirements.txt && \ |
9 | | - # One could install the pypfopt library directly in the image. We don't and share via docker-compose instead. |
10 | | - # pip install --no-cache-dir /tmp/pyhrp && \ |
11 | | - rm -r /tmp/pypfopt && \ |
| 8 | + pip install --upgrade pip==21.0.1 && \ |
| 9 | + pip install "poetry==1.1.4" && \ |
| 10 | + poetry install -E optionals --no-root && \ |
12 | 11 | apt-get purge -y --auto-remove $buildDeps |
13 | 12 |
|
14 | | - |
15 | | -# ---------------------------------------------------------------------------------------------------------------------- |
16 | | -FROM builder as test |
17 | | - |
18 | | -# COPY tools needed for testing into the image |
19 | | -RUN pip install --no-cache-dir pytest pytest-cov pytest-html |
20 | | - |
21 | | -# COPY the tests over |
22 | | -COPY tests /pypfopt/tests |
23 | | - |
24 | | -WORKDIR /pypfopt |
25 | | - |
26 | | -CMD py.test --cov=pypfopt --cov-report html:artifacts/html-coverage --cov-report term --html=artifacts/html-report/report.html tests |
| 13 | +COPY . . |
| 14 | + |
| 15 | +# Usage examples: |
| 16 | +# |
| 17 | +# Build |
| 18 | +# docker build . -t pypfopt |
| 19 | +# |
| 20 | +# Run |
| 21 | +# iPython interpreter: |
| 22 | +# docker run -it pypfopt poetry run ipython |
| 23 | +# Jupyter notebook server: |
| 24 | +# docker run -it -p 8888:8888 pypfopt poetry run jupyter notebook --allow-root --no-browser --ip 0.0.0.0 |
| 25 | +# Pytest |
| 26 | +# docker run -t pypfopt poetry run pytest |
| 27 | +# Bash |
| 28 | +# docker run -it pypfopt bash |
0 commit comments