Skip to content
Snippets Groups Projects
Commit c6610342 authored by Jeremy M Fee's avatar Jeremy M Fee
Browse files

Initial dockerfile

parent ae41d988
No related branches found
No related tags found
No related merge requests found
.DS_Store
node_modules
*.pyc
conf
FROM debian:jessie
MAINTAINER Jeremy Fee <jmfee@usgs.gov>
LABEL usgs.geomag-algorithms.version=0.2.0
# update os
RUN apt-get update --fix-missing && \
apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
curl \
gcc \
libcurl4-gnutls-dev \
libglib2.0-0 \
libgnutls28-dev \
libsm6 \
libxext6 \
libxrender1 && \
apt-get clean
ENV PATH /conda/bin:$PATH
# install conda and install obspy
RUN echo 'export PATH=/conda/bin:$PATH' > /etc/profile.d/conda.sh && \
curl https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh \
-o ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /conda && \
rm ~/miniconda.sh && \
conda config --add channels obspy && \
conda install --yes jupyter obspy && \
conda clean -i -l -t -y && \
pip install pycurl
# copy library (ignores set in .dockerignore)
COPY . /geomag-algorithms
RUN pip install /geomag-algorithms && \
mkdir /notebooks
WORKDIR /geomag-algorithms
EXPOSE 80
CMD /bin/bash -c " \
exec jupyter notebook \
--ip='*' \
--notebook-dir=/notebooks \
--no-browser \
--port=80 \
"
## Docker
https://www.docker.com/
Docker containers bundle all dependencies needed to use geomag-algorithms.
The container includes a Jupyter Notebook server for interactive development.
> Docker images are built using the `Dockerfile` at the root of this project.
### Create a new docker container
The following command creates and starts a container.
```
docker run -d --name geomagio -p 8000:80 usgs/geomag-algorithms
```
- `-d` runs container in the background
- `-name geomagio` assigns the name `geomagio`
- `-p 8000:80` forwards system port `8000` to container port `80`
- `usgs/geomag-algorithms:latest` refers to the
latest version of the geomag-algorithms docker image
> Notebooks are stored in the container in the directory `/notebooks`
### Use the container
- Start a stopped container:
```
docker start geomagio
```
- Run an interactive python prompt
```
docker exec -it geomagio python
```
- Use the Jupyter Notebook server
```
open http://localhost:8000/
```
- Use the `geomag.py` command line interface
```
docker exec -it geomagio geomag.py \
--inchannels H E Z F \
--input edge \
--interval minute \
--observatory BOU \
--output iaga2002 \
--output-stdout \
--starttime 2016-07-04T00:00:00Z \
--endtime 2016-07-04T23:59:00Z
```
- Stop a running container:
```
docker stop geomagio
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment