|  | 
| 1 |  | -FROM pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime@sha256:7db0e1bf4b1ac274ea09cf6358ab516f8a5c7d3d0e02311bed445f7e236a5d80 | 
|  | 1 | +### | 
|  | 2 | +### docker build --ssh default=/path/to/private.key -f Dockerfile . | 
| 2 | 3 | 
 | 
| 3 |  | -RUN apt update | 
| 4 |  | -RUN apt install -y libpq-dev ffmpeg libsm6 libxext6 git wget | 
|  | 4 | +ARG BASE=ubuntu:22.04 | 
|  | 5 | +ARG BASE_PYTORCH=pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime@sha256:7db0e1bf4b1ac274ea09cf6358ab516f8a5c7d3d0e02311bed445f7e236a5d80 | 
|  | 6 | +ARG PLATFORM=linux/amd64 | 
| 5 | 7 | 
 | 
| 6 |  | -# Install Go (used for Satlas smooth_point_labels_viterbi.go). | 
| 7 |  | -RUN wget https://go.dev/dl/go1.22.12.linux-amd64.tar.gz | 
| 8 |  | -RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.12.linux-amd64.tar.gz | 
| 9 |  | -ENV PATH="${PATH}:/usr/local/go/bin" | 
|  | 8 | +FROM --platform=${PLATFORM} ${BASE} AS tippecanoe | 
| 10 | 9 | 
 | 
| 11 |  | -# Install tippecanoe (used by forest loss driver). | 
| 12 |  | -RUN apt install -y build-essential libsqlite3-dev zlib1g-dev | 
| 13 |  | -RUN git clone https://github.com/mapbox/tippecanoe /opt/tippecanoe | 
| 14 |  | -WORKDIR /opt/tippecanoe | 
|  | 10 | +RUN apt-get update && apt-get install -y --no-install-recommends build-essential ca-certificates curl libsqlite3-dev zlib1g-dev | 
|  | 11 | + | 
|  | 12 | +RUN mkdir -p /tmp/tippecanoe && curl -L https://github.com/mapbox/tippecanoe/archive/refs/tags/1.36.0.tar.gz | tar -xvz --strip 1 -C /tmp/tippecanoe | 
|  | 13 | +WORKDIR /tmp/tippecanoe | 
| 15 | 14 | RUN make -j | 
| 16 |  | -RUN make install | 
|  | 15 | +RUN PREFIX=/opt/tippecanoe make install | 
|  | 16 | + | 
|  | 17 | +# To use this: | 
|  | 18 | +#  COPY --from=tippecanoe /opt/tippecanoe /opt/tippecanoe | 
|  | 19 | +#  ENV PATH="/opt/tippecanoe/bin:${PATH}" | 
|  | 20 | + | 
|  | 21 | +FROM --platform=${PLATFORM} ${BASE} AS golang | 
|  | 22 | + | 
|  | 23 | +## Build Satlas smooth_point_labels_viterbi.go (Requires golang) | 
|  | 24 | +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl | 
|  | 25 | +RUN curl -L https://go.dev/dl/go1.22.12.linux-amd64.tar.gz | tar -xvz -C /usr/local | 
|  | 26 | +ENV PATH="/usr/local/go/bin:${PATH}" | 
|  | 27 | + | 
|  | 28 | +COPY rslp/satlas/scripts /tmp/smooth_point_labels_viterbi/ | 
|  | 29 | +WORKDIR /tmp/smooth_point_labels_viterbi/ | 
|  | 30 | +RUN go build smooth_point_labels_viterbi.go | 
|  | 31 | + | 
|  | 32 | +# To use this: | 
|  | 33 | +#  COPY --from=golang /tmp/smooth_point_labels_viterbi/smooth_point_labels_viterbi /usr/local/bin/smooth_point_labels_viterbi | 
|  | 34 | + | 
|  | 35 | +FROM --platform=${PLATFORM} pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime@sha256:7db0e1bf4b1ac274ea09cf6358ab516f8a5c7d3d0e02311bed445f7e236a5d80 AS base | 
|  | 36 | + | 
|  | 37 | +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git`` | 
|  | 38 | + | 
|  | 39 | +COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | 
|  | 40 | + | 
|  | 41 | +COPY . /opt/rslearn_projects/ | 
|  | 42 | +# We assume that the caller has already cloned olmoearth_run and olmoearth_pretrain to /opt/rslearn_projects/docker_build/ | 
|  | 43 | +RUN echo 'olmoearth_run[runner] @ /opt/rslearn_projects/docker_build/olmoearth_run/' > /opt/rslearn_projects/requirements-olmoearth_run.txt | 
|  | 44 | +RUN echo 'olmoearth_pretrain @ /opt/rslearn_projects/docker_build/olmoearth_pretrain/' > /opt/rslearn_projects/requirements-olmoearth_pretrain.txt | 
|  | 45 | +RUN uv pip install --system /opt/rslearn_projects[olmoearth_run,olmoearth_pretrain] | 
|  | 46 | + | 
|  | 47 | +FROM base AS full | 
|  | 48 | + | 
|  | 49 | +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git openssh-client | 
| 17 | 50 | 
 | 
|  | 51 | +# Pin GitHub’s host keys so SSH won’t prompt | 
|  | 52 | +RUN mkdir -p -m 700 /root/.ssh && \ | 
|  | 53 | +    ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /root/.ssh/known_hosts \ | 
|  | 54 | + | 
|  | 55 | +COPY --from=tippecanoe /opt/tippecanoe /opt/tippecanoe | 
|  | 56 | +COPY --from=golang /tmp/smooth_point_labels_viterbi/smooth_point_labels_viterbi /usr/local/bin/smooth_point_labels_viterbi | 
| 18 | 57 | COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | 
| 19 | 58 | 
 | 
| 20 |  | -# Install rslearn. | 
| 21 |  | -# We use git clone and then git checkout instead of git clone -b so that the user could | 
| 22 |  | -# specify a commit name or branch instead of only accepting a branch. | 
|  | 59 | +ENV PATH="/opt/tippecanoe/bin:${PATH}" | 
|  | 60 | + | 
|  | 61 | +## Install rslearn. | 
|  | 62 | +## We use git clone and then git checkout instead of git clone -b so that the user could | 
|  | 63 | +## specify a commit name or branch instead of only accepting a branch. | 
| 23 | 64 | ARG RSLEARN_BRANCH=master | 
| 24 |  | -RUN git clone https://github.com/allenai/rslearn.git /opt/rslearn | 
|  | 65 | +RUN --mount=type=ssh git clone git@github.com:allenai/rslearn.git /opt/rslearn | 
| 25 | 66 | WORKDIR /opt/rslearn | 
| 26 | 67 | RUN git checkout $RSLEARN_BRANCH | 
| 27 | 68 | RUN uv pip install --system /opt/rslearn[extra] | 
| 28 | 69 | 
 | 
| 29 |  | -# Install rslearn_projects. | 
| 30 | 70 | COPY . /opt/rslearn_projects/ | 
| 31 | 71 | RUN uv pip install --system /opt/rslearn_projects[dev,extra] | 
| 32 |  | - | 
| 33 |  | -# Build Satlas smooth_point_labels_viterbi.go program. | 
| 34 |  | -WORKDIR /opt/rslearn_projects/rslp/satlas/scripts | 
| 35 |  | -RUN go build smooth_point_labels_viterbi.go | 
| 36 |  | - | 
| 37 |  | -WORKDIR /opt/rslearn_projects | 
|  | 
0 commit comments