-
Notifications
You must be signed in to change notification settings - Fork 23
/
Dockerfile
96 lines (75 loc) · 2.97 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
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
# SPDX-FileCopyrightText: 2022 Renaissance Computing Institute. All rights reserved.
#
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LicenseRef-RENCI
# SPDX-License-Identifier: MIT
##############
# Docker file for running Kalpana.
#
# to create image: docker build -t kalpana:latest .
# to push image:
# docker tag kalpana:latest containers.renci.org/eds/kalpana:latest
# docker push containers.renci.org/eds/kalpana:latest
##############
# Use grass alpine image.
FROM frolvlad/alpine-miniconda3 as build
# author
MAINTAINER Jim McManus
# extra metadata
LABEL version="v0.0.9"
LABEL description="Kalpana image with Dockerfile."
# update conda
RUN conda update conda
# Create the virtual environment
COPY build/env_kalpana_v1.yml .
RUN conda env create -f env_kalpana_v1.yml
# install conda pack to compress this stage
RUN conda install -c conda-forge conda-pack
# conpress the virtual environment
RUN conda-pack -n env_kalpana_v1 -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
# fix up the paths
RUN /venv/bin/conda-unpack
##############
# stage 2: create a python implementation using the stage 1 virtual environment
##############
FROM mundialis/grass-py3-pdal:8.2.1-alpine
# Install libraries required to install miniconda.
RUN apk --update add bash curl wget ca-certificates libstdc++ glib \
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-node-bower/master/sgerrand.rsa.pub \
&& curl -L "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk" -o glibc.apk \
&& apk add glibc.apk \
&& curl -L "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-bin-2.23-r3.apk" -o glibc-bin.apk \
&& apk add glibc-bin.apk \
&& curl -L "https://github.com/andyshinn/alpine-pkg-glibc/releases/download/2.25-r0/glibc-i18n-2.25-r0.apk" -o glibc-i18n.apk \
&& apk add --allow-untrusted glibc-i18n.apk \
&& /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc/usr/lib \
&& rm -rf glibc*apk /var/cache/apk/*
# Set bash as default shell.
ENV SHELL /bin/bash
# Add user kalpana; -u xxxx (1324) is specific to running on a RENCI VM. It
# enables writing to the /projects directory. To use change 1324 to your user ID.
# If not on a RENCI VM use RUN adduser -D kalpana kalpana.
#RUN adduser -D nru -u 1324 nru
RUN adduser -D nru -u 1000 nru
# Make working directory /home/nru.
WORKDIR /home/nru
# Copy /venv from the previous stage:
COPY --from=build /venv /venv
# make the virtual environment active
ENV VIRTUAL_ENV /venv
ENV PATH /venv/bin:$PATH
# Copy Kalpana Python scripts.
COPY kalpana kalpana
# Set GDAL env variables
ENV GDAL_DATA=/venv/share/gdal
ENV GDAL_DRIVER_PATH=/venv/lib/gdalplugins
ENV PROJ_LIB=/venv/share/proj
# Change owner of /home/nru to nru.
RUN chown -R nru:nru /home/nru
# Make user kalpana.
USER nru
# Initialize conda using the bash shell.
#RUN conda init bash