Skip to content

Commit 1afd603

Browse files
authored
Merge pull request #10 from gboeing/docker
update docker for v0.3.3
2 parents c7756a0 + b3c7aa4 commit 1afd603

4 files changed

Lines changed: 14 additions & 333 deletions

File tree

docker/Dockerfile

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,16 @@
1-
########################################################################
2-
# Pynamical Dockerfile
3-
# License: MIT, see full license in LICENSE.txt
4-
# Web: https://github.com/gboeing/pynamical
5-
#
6-
# Build an image from the dockerfile:
7-
# >>> docker build -t gboeing/pynamical .
8-
#
9-
# Push the built image to hub so others can pull/run it:
10-
# >>> docker login
11-
# >>> docker tag gboeing/pynamical gboeing/pynamical:v0.0.0
12-
# >>> docker push -a gboeing/pynamical
13-
#
14-
# Run bash in this container and export final conda environment to a yml file:
15-
# >>> docker run --rm -it -u 0 --name pynamical -v %cd%:/home/jovyan/work gboeing/pynamical /bin/bash
16-
# >>> conda env export -n base > /home/jovyan/work/environment.yml
17-
#
18-
# Run jupyter lab in this container:
19-
# >>> docker run --rm -it --name pynamical -p 8888:8888 -v %cd%:/home/jovyan/work gboeing/pynamical
20-
# >>> docker run --rm -it --name pynamical -p 8888:8888 -v $PWD:/home/jovyan/work gboeing/pynamical
21-
#
22-
# Stop/delete all local docker containers/images:
23-
# >>> docker stop $(docker ps -aq)
24-
# >>> docker rm $(docker ps -aq)
25-
# >>> docker rmi $(docker images -q)
26-
########################################################################
27-
281
FROM jupyter/base-notebook
292
LABEL maintainer="Geoff Boeing <boeing@usc.edu>"
303
LABEL url="https://github.com/gboeing/pynamical"
314
LABEL description="Pynamical is a Python package for modeling, simulating, visualizing, and animating discrete nonlinear dynamical systems and chaos."
325

33-
COPY requirements.txt /tmp/
6+
COPY --chmod=0755 requirements.txt /tmp/
347

35-
# configure conda and install packages in one RUN to keep image tidy
36-
RUN conda config --set show_channel_urls true && \
37-
conda config --set channel_priority strict && \
38-
conda config --prepend channels conda-forge && \
39-
conda update --yes -n base conda && \
40-
conda install --update-all --force-reinstall --yes --file /tmp/requirements.txt && \
41-
rm -f -r -v /opt/conda/share/jupyter/kernels/python3 && \
8+
# install and configuration everything in one RUN to keep image tidy
9+
RUN conda update --yes -c conda-forge --strict-channel-priority -n base conda mamba && \
10+
mamba install --update-all --force-reinstall --yes -c conda-forge --strict-channel-priority --file /tmp/requirements.txt && \
4211
python -m ipykernel install --sys-prefix --name pynamical --display-name "Python (pynamical)" && \
43-
conda clean --all --yes && \
12+
rm -f -r -v /opt/conda/share/jupyter/kernels/python3 && \
13+
conda clean --all --yes --quiet && \
4414
conda info --all && \
4515
conda list && \
4616
jupyter kernelspec list && \

docker/docker-build.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
2-
docker stop $(docker ps -aq)
3-
docker rm $(docker ps -aq)
4-
docker rmi $(docker images -q) --force
5-
docker build -t gboeing/pynamical .
6-
docker run --rm -v "$PWD":/home/jovyan/work gboeing/pynamical:latest /bin/bash -c "conda env export -n base > /home/jovyan/work/environment.yml"
2+
set -euo pipefail
3+
echo "Run this script from the repository root."
4+
docker login
5+
docker buildx build --no-cache --pull --push --platform=linux/amd64,linux/arm64 -f ./Dockerfile -t gboeing/pynamical .
6+
IMPORTED_VERSION=$(docker run --rm gboeing/pynamical:latest /bin/bash -c "ipython -c \"import pynamical; print(pynamical.__version__)\"")
7+
echo "Imported $IMPORTED_VERSION"

docker/environment.yml

Lines changed: 0 additions & 290 deletions
This file was deleted.

docker/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pandas
1515
pillow
1616
pip
1717
pydocstyle
18-
pynamical
18+
pynamical == 0.3.3
1919
pytest
20-
python == 3.10.*
20+
python
2121
sphinx

0 commit comments

Comments
 (0)