@@ -3,24 +3,24 @@ FROM pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime
33RUN apt update
44RUN apt install -y libpq-dev ffmpeg libsm6 libxext6 git wget
55
6- # Install rslearn and olmoearth_pretrain (need to be in local directory).
7- COPY ./docker_build/rslearn /opt/rslearn
8- COPY ./docker_build/olmoearth_pretrain /opt/olmoearth_pretrain
9-
10- # We also install terratorch so that we can use the same Docker image for TerraMind
11- # experiments.
12- RUN pip install --no-cache-dir git+https://github.com/IBM/terratorch.git
13- RUN pip install --no-cache-dir geobench==0.0.1
14-
15- RUN pip install --no-cache-dir --upgrade /opt/rslearn[extra]
16- RUN pip install --no-cache-dir --upgrade /opt/olmoearth_pretrain
6+ # Use uv to install everything.
7+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
178
18- COPY requirements-without-rslearn.txt /opt/rslearn_projects/requirements-without-rslearn.txt
9+ # Install dependencies for rslearn, olmoearth_pretrain, and rslearn_projects.
10+ COPY docker_build/rslearn/pyproject.toml /opt/rslearn/pyproject.toml
11+ COPY docker_build/olmoearth_pretrain/pyproject.toml /opt/olmoearth_pretrain/pyproject.toml
12+ COPY requirements.txt /opt/rslearn_projects/requirements.txt
1913COPY requirements-extra.txt /opt/rslearn_projects/requirements-extra.txt
20- RUN pip install --no-cache-dir -r /opt/rslearn_projects/requirements-without-rslearn.txt -r /opt/rslearn_projects/requirements-extra.txt
14+ # Using cache mount here avoids needing to re-download dependencies for later builds if the version didn't change.
15+ RUN --mount=type=cache,target=/root/.cache/uv uv pip install --system /opt/rslearn[extra] /opt/olmoearth_pretrain -r /opt/rslearn_projects/requirements.txt -r /opt/rslearn_projects/requirements-extra.txt
2116
22- # Copy rslearn_projects and install it too.
17+ # Now copy the source code and install for real.
18+ # If we don't change any dependencies, then only these steps need to be repeated
19+ # (fast and means the new layers have small size).
20+ COPY ./docker_build/rslearn /opt/rslearn
21+ COPY ./docker_build/olmoearth_pretrain /opt/olmoearth_pretrain
2322COPY . /opt/rslearn_projects/
24- RUN pip install --no-cache-dir /opt/rslearn_projects
23+
24+ RUN --mount=type=cache,target=/root/.cache/uv uv pip install --system /opt/rslearn[extra] /opt/olmoearth_pretrain /opt/rslearn_projects[extra]
2525
2626WORKDIR /opt/rslearn_projects
0 commit comments