forked from dtarb/TauDEM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (48 loc) · 1.8 KB
/
Dockerfile
File metadata and controls
62 lines (48 loc) · 1.8 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
# This Dockerfile builds and installs TauDEM using a multi-stage build for optimization
# --- Builder Stage ---
FROM ubuntu:22.04 AS builder
# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary dependencies to compile TauDEM
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
libopenmpi-dev \
libgdal-dev \
libproj-dev \
libtiff-dev \
libgeotiff-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /src
# Copy source code (leveraging .dockerignore to exclude unnecessary files)
COPY . .
# Build and install TauDEM to a temporary directory
# We use PREFIX=/install so it installs to /install/taudem
RUN make release COMPILER=linux && \
make install PREFIX=/install && \
echo "=== Validating build ===" && \
test -f /install/taudem/pitremove || (echo "ERROR: pitremove not found" && exit 1)
# --- Runtime Stage ---
FROM ubuntu:22.04
LABEL maintainer="TauDEM Developers"
LABEL description="Parallel C++ suite for terrain analysis using Digital Elevation Models"
# Avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install only runtime dependencies
# libgdal30 is the runtime for GDAL on Ubuntu 22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
openmpi-bin \
libgdal30 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the installed TauDEM binaries from the builder stage
COPY --from=builder /install/taudem /usr/local/taudem
# Set the PATH environment variable globally to include taudem directory
ENV PATH="/usr/local/taudem:${PATH}"
# Create a non-root user for security
RUN useradd -m -s /bin/bash taudem
USER taudem
WORKDIR /home/taudem
# Set the default command to run an interactive shell
CMD ["/bin/bash"]