Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
26 changes: 0 additions & 26 deletions Dockerfile

This file was deleted.

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.

30 changes: 30 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM python:3.8-slim-buster

WORKDIR pypfopt
COPY pyproject.toml poetry.lock ./

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that only the poetry files are copied initially. These change infrequently (compared to other code). Thus, the dependency installation remains cached by docker, even if other files are changed (much faster builds after the first time).


RUN buildDeps='gcc g++' && \
apt-get update && apt-get install -y $buildDeps --no-install-recommends && \
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

COPY . .

# Usage examples:
#
# Build
# from root of repo:
# docker build -f docker/Dockerfile . -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
# click on http://127.0.0.1:8888/?token=xxx
# Pytest
# docker run -t pypfopt poetry run pytest
# Bash
# docker run -it pypfopt bash