-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (54 loc) · 2.4 KB
/
Copy pathDockerfile
File metadata and controls
68 lines (54 loc) · 2.4 KB
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
FROM registry.access.redhat.com/ubi8/python-39
MAINTAINER alexdunnjpl "Alexander Dunn, Jet Propulsion Laboratory"
LABEL description="Gravity Missions Analysis Tool Backend Systems"
ENV TSDB_HOST='localhost'
ENV TSDB_PORT='5433'
ENV TSDB_USER='postgres'
ENV TSDB_PASSWORD='password'
ENV TSDB_DATABASE='masschange'
# N.B. user must be 'root' if running in user-namespaced docker setup, else 'appuser' or some other suitable name
# this requires hardcoding due to use in RUN [..] and the inability to use tilde expansion in some necessary contexts
# Install core system dependencies
USER root
ENV HOME='/home/root'
RUN mkdir $HOME \
&& mkdir /app \
&& dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
&& yum -y update; yum clean all \
&& yum -y install python3-pip; yum clean all \
&& pip3 install --upgrade setuptools wheel \
&& yum -y install htop git which wget rsync procps \
# && yum -y install python310-devel libpq-devel \
&& dnf -y install hostname
# Install conda
USER root
RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" -O /tmp/Miniconda3-latest-Linux-x86_64.sh \
&& bash /tmp/Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
ENV PATH=$PATH:$HOME/miniconda/condabin
# Set up non-src-dependent conda environment
USER 0
COPY environment.yml /tmp/preliminary-environment.yml
RUN chmod a+r /tmp/preliminary-environment.yml
USER root
RUN ["/bin/bash", "--login", "-c", "$HOME/miniconda/condabin/conda env create -f /tmp/preliminary-environment.yml"]
RUN ["/bin/bash", "--login", "-c", "$HOME/miniconda/condabin/conda init"]
# Set application env vars
ENV MASSCHANGE_REPO_ROOT=/app/masschange
ENV MASSCHANGE_CONFIG_ROOT=/home/root/.config/masschange
# Copy application files
USER 0
COPY . $MASSCHANGE_REPO_ROOT
RUN chown -R root /app
# Copy configuration defaults file
USER root
RUN mkdir -p $MASSCHANGE_CONFIG_ROOT
COPY ./defaults.conf.ini $MASSCHANGE_CONFIG_ROOT
# Make scripts executable
RUN chmod +x $MASSCHANGE_REPO_ROOT/*.sh
# Install MassChange to existing conda environment
USER root
RUN ["/home/root/miniconda/condabin/conda", "run", "-n", "masschange", "/bin/bash", "--login", "-c", "pip3 install -e /app/masschange"]
# Overridable as runtime env-var, used for reverse-proxying
ENV API_ROOT_PATH ""
RUN ln -s $MASSCHANGE_REPO_ROOT/entrypoint.sh /app/entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]