This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
forked from healthysustainablecities/global-indicators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (60 loc) · 3.05 KB
/
Dockerfile
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
##############################################################################
# Build an image from the dockerfile:
# >>> docker build -t globalhealthyliveablecities/global-indicators:latest .
#
# Run bash in this container from main project folder and export package versions to Docker/requirements.txt:
# >>> docker run --rm -it --shm-size=2g --net=host -v "$PWD":/home/ghsci/work globalhealthyliveablecities/global-indicators /bin/bash
# >>> pip list --format=freeze > ./Docker/requirements.txt
#
# Push to docker hub
# docker login
# docker tag globalhealthyliveablecities/global-indicators globalhealthyliveablecities/global-indicators:latest
# docker tag globalhealthyliveablecities/global-indicators globalhealthyliveablecities/global-indicators:yyyy-mm-dd
# docker push --all-tags globalhealthyliveablecities/global-indicators
#
# Stop/delete all local docker containers/images:
# >>> docker stop $(docker ps -aq)
# >>> docker rm $(docker ps -aq)
# >>> docker rmi $(docker images -q) --force
##############################################################################
FROM continuumio/miniconda3:latest as build
LABEL maintainer="Global Healthy Liveable City Indicator Study Collaboration Group"
LABEL url="https://github.com/global-healthy-liveable-cities/global-indicators"
COPY environment.yml .
# add root/bin to path so that tex commands can be run from container
ENV PATH=$PATH:/root/bin
# Install conda pack
RUN conda config --set show_channel_urls true && \
conda config --set channel_priority strict && \
conda config --prepend channels conda-forge && \
conda update --yes -n base conda && \
conda install -c conda-forge conda-pack && \
conda env create -n env -f environment.yml && \
conda pack -n env -o env.tar.gz && \
conda list -n env --explicit > spec-file.txt
# =============================================================================
# Runtime environment
FROM debian:stable-slim as runtime
# Install the environment pack
COPY --from=build /env.tar.gz .
RUN mkdir /env && \
tar xvzf /env.tar.gz -C /env && \
rm -rv /env.tar.gz && \
/env/bin/python /env/bin/conda-unpack && \
useradd -u 8877 ghsci && \
# install tools for using OpenStreetMap
apt-get update && apt-get install -y git osm2pgsql osmctools
ENV PATH="/env/bin/:$PATH"
ENV PROJ_LIB="/env/share/proj"
RUN pip install -e git+https://github.com/wklumpen/gtfs-lite.git#egg=gtfs-lite && \
pip install -e git+https://github.com/anerv/BikeDNA_BIG#egg=src && \
echo 'alias configure="python configure.py"' >> ~/.bashrc && \
echo 'alias analysis="python analysis.py"' >> ~/.bashrc && \
echo 'alias generate="python generate.py"' >> ~/.bashrc && \
echo 'alias compare="python compare.py"' >> ~/.bashrc && \
echo 'alias ghsci="python gui.py"' >> ~/.bashrc && \
echo 'alias help="cat ../help.txt"' >> ~/.bashrc && \
echo 'alias lab="jupyter lab --no-browser --notebook-dir=/home/ghsci/process --allow-root --config=/home/ghsci/jupyter_notebook_config.py"' >> ~/.bashrc && \
echo 'export PS1="# "' >> ~/.bashrc
USER ghsci
WORKDIR /home/ghsci