-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (52 loc) · 1.91 KB
/
Dockerfile
File metadata and controls
66 lines (52 loc) · 1.91 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
# Build stage for reclaimer (used to download from Zenodo)
FROM golang:latest AS reclaimerbuild
RUN git clone https://github.com/quantifyearth/reclaimer.git
WORKDIR /go/reclaimer
RUN go mod tidy
RUN go build
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.12.1
RUN apt-get update -qqy && \
apt-get install -qy \
git \
cmake \
python3-pip \
r-base \
libpq-dev \
libtirpc-dev \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/*
COPY --from=reclaimerbuild /go/reclaimer/reclaimer /bin/reclaimer
RUN rm /usr/lib/python3.*/EXTERNALLY-MANAGED
RUN pip install gdal[numpy]==3.12.1
COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt
# Snakemake linting/formatting tools
RUN pip install snakefmt
RUN mkdir /root/R
ENV R_LIBS_USER=/root/R
RUN Rscript -e 'install.packages(c("lme4","lmerTest","emmeans"), repos="https://cloud.r-project.org")'
COPY ./ /root/star
WORKDIR /root/star
# We create a DATADIR - this should be mapped at container creation
# time to a volume somewhere else
ENV DATADIR=/data
RUN mkdir -p /data
# This is because outside of Docker we want to ensure
# the Python virtualenv is set, but in Docker we don't
# use a virtualenv, as docker *is* a virtualenv
ENV VIRTUAL_ENV=/usr
ENV PYTHONPATH=/root/star
RUN python3 -m pytest ./tests
RUN python3 -m pylint prepare_layers prepare_species threats utils tests
RUN python3 -m mypy prepare_layers prepare_species threats utils tests
# Snakemake validation
RUN snakefmt --check workflow/
# RUN snakemake --snakefile workflow/Snakefile --lint
# Copy and set up entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Default command runs the full Snakemake pipeline
# Use --cores to specify parallelism, e.g.: docker run ... --cores 8
# Logs are written to $DATADIR/logs/ and .snakemake/ metadata is stored in $DATADIR/
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["--cores", "4", "all"]