forked from uaf-arctic-eco-modeling/dvm-dos-tem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-mapping-support
136 lines (89 loc) · 3.39 KB
/
Dockerfile-mapping-support
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Dockerfile for an image that has geospatial tools, i.e. GDAL.
# I was unable to get GDAL to work well in the same image with dvmdostem
# and it's associated python scripts. So here is a separate image that has
# GDAL and Python working well together.
# need this for netCDF
FROM osgeo/gdal:ubuntu-full-3.2.2
# Might want this if workflow includes running interactive shell on
# the container resulting from this image...
#USER root
#RUN apt-get update
#RUN apt-get install bash-completion
# Make a developer user so as not to always be root
RUN useradd -ms /bin/bash develop
RUN echo "develop ALL=(ALL:ALL) ALL" >> /etc/sudoers
USER develop
# Pyenv dependencies
USER root
RUN apt-get update --fix-missing && apt-get install -y \
build-essential \
curl \
git \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
llvm \
python-openssl \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Pyenv seems to work well for overall python versioning and packagemanagement.
# Not sure how to best manage pip requirements.txt yet between this mapping
# support image and the other dvmdostem images.
USER develop
ENV HOME=/home/develop
RUN git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv
ENV PYENV_ROOT=$HOME/.pyenv
ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
RUN pyenv install 3.8.6
RUN pyenv global 3.8.6
RUN pyenv rehash
RUN python --version
RUN pip install -U pip pipenv
COPY requirements_mapping.txt .
RUN pip install -r requirements_mapping.txt
# or use this if not wanting to use requirements.txt...
# Bug with ipython 7.19.0, so need to downgrade and pin jedi verison
# https://github.com/ipython/ipython/issues/12740
#RUN pip install matplotlib numpy pandas bokeh netCDF4 commentjson
#RUN pip install ipython
#RUN pip install jedi==0.17.2
WORKDIR /work
## EXAMPLES
# run bokeh server in scripts directory on container start:
#CMD bokeh serve scripts
# setup to run the container with input catalog attached a volume.
#INCATALOG=/some/path/to/your/catalog
# docker run -it --rm -p 5006:5006 --volume $(pwd):/work --volume $INCATALOG:/data/dvmdostem-input-catalog dvmdostem-mapping-support:0.0.1
## NOTES #
# Dockerfile words:
# RUN - is used to install stuff and setup environment
# CMD - only a single CMD per image, default command when starting container, easily overrridden by docker run
# ENTRYPOINT - the CMD is *always* appended to ENTRYPOINT
#-------------------
# FROM perrygeo/gdal-base:latest as builder
# # Python dependencies that require compilation
# COPY requirements.txt .
# RUN python -m pip install cython numpy -c requirements.txt
# RUN python -m pip install --no-binary fiona,rasterio,shapely -r requirements.txt
# RUN pip uninstall cython --yes
# # ------ Second stage
# # Start from a clean image
# FROM python:3.8-slim-buster as final
# # Install some required runtime libraries from apt
# RUN apt-get update \
# && apt-get install --yes --no-install-recommends \
# libfreexl1 libxml2 libffi-dev\
# && rm -rf /var/lib/apt/lists/*
# # Install the previously-built shared libaries from the builder image
# COPY --from=builder /usr/local/* /usr/local/
# RUN ldconfig -v
#FROM osgeo/gdal:ubuntu-small-latest