-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
51 lines (41 loc) · 1.99 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
# This docker image simply runs luigi's centralized scheduler with the needed
# dependencies installed into a conda environment. All QGreenland tasks are
# available at `TASKS_DIR`.
FROM axiom/docker-luigi:3.0.3-alpine AS luigi
# This build stage only exists to grab the luigi run script. Luigi dependency
# itself is specified in our conda environment.
# TODO: Why is this necessary? Does `luigid` not come along with the conda package?
FROM mambaorg/micromamba:1.4.2 AS micromamba
COPY --from=luigi /bin/run /usr/local/bin/luigid
USER root
# `libgl1-mesa-glx` is required for pyqgis
# `git` is required for analyzing the current version
# `make` is required for building sphinx docs
# `texlive-latex-extra` is required for pdf doc builds
RUN apt-get update && apt-get install -y \
git \
make \
libgl1-mesa-glx \
texlive-latex-extra
ENV TASKS_DIR=/luigi/tasks/qgreenland
WORKDIR "${TASKS_DIR}"
COPY --chown=$MAMBA_USER:$MAMBA_USER . .
# Our code needs to run git commands (for example, to determine a full version
# string), but if tasks repo is mounted from the host machine, the owner of
# the repo won't match the container user. A "safe directory" allows Git to
# tolerate this user mismatch.
RUN git config --global --add safe.directory "${TASKS_DIR}"
# Set up the main environment and the command environment
RUN micromamba install --yes --name "base" --file "environments/main/conda-lock.yml"
RUN micromamba create --yes --name "qgreenland-cmd" --file "environments/command/conda-lock.yml"
# Cleanup
RUN micromamba clean --all --yes
WORKDIR /luigi
# Everything is installed to the base conda environment, but the docker image
# doesn't activate the env automatically, which is how the PYTHONPATH normally
# gets populated. Additionally, /luigi/tasks is where we expect python code to
# be mounted.
# TODO: With modern micromamba, can we clean this up?
ENV PYTHONPATH "${TASKS_DIR}:/opt/conda/share/qgis/python/plugins:/opt/conda/share/qgis/python"
ENV PATH "/opt/conda/bin:${PATH}"
CMD ["/usr/local/bin/luigid"]