-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 1013 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 1013 Bytes
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
# Use a geospatial-ready R base image
FROM rocker/geospatial:4.4.0
# Install Python 3 and dependencies
RUN apt-get update && apt-get install -y \
python3-pip \
python3-dev \
libosmium2-dev \
libgdal-dev \
osmium-tool \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Set PYTHONPATH to include the src directory
ENV PYTHONPATH="/app/src:${PYTHONPATH}"
# Copy requirement files first for better caching
COPY requirements.txt .
# Install Python packages
RUN pip3 install --no-cache-dir -r requirements.txt
# Install specific R packages needed for the script
RUN R -e "install.packages(c('caret', 'CAST', 'ranger', 'randomForest', 'mapview', 'viridis', 'here', 'doParallel', 'jsonlite', 'pROC', 'yaml'), repos='https://cloud.r-project.org/')"
# Copy the entire project
COPY . .
# Ensure main.py is executable
RUN chmod +x main.py
# Default command: run only training if data is pre-populated, or everything
CMD ["python3", "main.py", "--step", "all"]