Skip to content

Commit 287cad3

Browse files
Docker dev container for easy development of the project
1 parent 1a5bfee commit 287cad3

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
2+
3+
# Install system dependencies
4+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5+
&& apt-get -y install --no-install-recommends \
6+
software-properties-common \
7+
&& add-apt-repository -y ppa:ubuntugis/ppa \
8+
&& apt-get update \
9+
&& apt-get -y install --no-install-recommends \
10+
build-essential \
11+
ninja-build \
12+
libgdal-dev \
13+
gdal-bin \
14+
python3-dev \
15+
python3-pip \
16+
python3-opencv \
17+
git \
18+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
19+
20+
# Set environment variables for GDAL
21+
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
22+
ENV C_INCLUDE_PATH=/usr/include/gdal
23+
24+
# Install Python dependencies
25+
# We install torch CPU version first to avoid pulling in huge CUDA deps
26+
RUN python3 -m pip install --upgrade pip wheel \
27+
&& python3 -m pip install opencv-python cython \
28+
&& python3 -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu \
29+
&& python3 -m pip install wandb sphinx pycocotools
30+
31+
# Install detectron2
32+
RUN python3 -m pip install --no-build-isolation 'git+https://github.com/facebookresearch/detectron2.git'
33+
34+
# Install other dependencies from setup.py
35+
RUN python3 -m pip install pyyaml numpy pandas tqdm shapely geopandas "rasterio<1.4" fiona rtree
36+
37+
# Clean up
38+
RUN python3 -m pip cache purge

.devcontainer/devcontainer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "Detectree2 Dev Container",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"ms-python.python",
10+
"ms-python.vscode-pylance",
11+
"ms-toolsai.jupyter",
12+
"njpwerner.autodocstring",
13+
"donjayamanne.githistory"
14+
]
15+
}
16+
},
17+
"postCreateCommand": "python3 -m pip install -e . && sed '/^-e/d' requirements/dev-requirements.txt > /tmp/dev-reqs.txt && python3 -m pip install -r /tmp/dev-reqs.txt",
18+
"remoteUser": "vscode"
19+
}

0 commit comments

Comments
 (0)