Fix #4. Needed to mount ~/.ssh and make sure that it has the same UID/GID as the host user

This commit is contained in:
Diego Ripley
2025-06-26 15:14:33 +00:00
parent a55e1d325d
commit 2f346bfa4c
2 changed files with 32 additions and 14 deletions
+24 -9
View File
@@ -1,10 +1,18 @@
FROM ghcr.io/osgeo/gdal:ubuntu-full-3.11.0
# Ubuntu is UID 1000 and GID 1000
ARG USERNAME=ubuntu
USER root
RUN apt-get update -y \
RUN apt-get update \
&& apt-get -y install gcc g++ make libsqlite3-dev zlib1g-dev
# Add user to sudoers
RUN apt-get -y install sudo \
&& echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}
# Utilities
RUN apt-get install -y neovim \
python3-neovim \
@@ -30,23 +38,30 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="/usr/local/
# Create virtual environment and install Python packages
RUN uv venv ~/.venv \
&& cd ~ \
&& uv pip install 'geopandas[all]' duckdb psycopg2-binary jupyterlab lonboard click stats-can openpyxl ordered-set sqlfluff buckaroo jenkspy 'polars[all]'
&& uv pip install 'geopandas[all]' duckdb psycopg2-binary jupyterlab lonboard click stats-can openpyxl ordered-set buckaroo jenkspy 'polars[all]'
# Bash Kernel
RUN cd ~ \
&& uv pip install bash_kernel \
&& /root/.venv/bin/python -m bash_kernel.install
# Install DuckDB
RUN mkdir -p ~/.local/bin \
&& curl https://install.duckdb.org | sh
# When user logs in, we use the spatial virtual environment
RUN echo 'source /root/.venv/bin/activate' > ~/.bashrc \
&& echo 'export PATH="~/.local/bin:${PATH}"' >> ~/.bashrc
RUN echo 'source /home/'${USERNAME}'/.venv/bin/activate' > ~/.bashrc \
&& echo 'export PATH="/home/'${USERNAME}'/.local/bin:${PATH}"' >> ~/.bashrc
RUN mv /root/.venv /home/${USERNAME} \
&& mv /root/.bashrc /home/${USERNAME} \
&& chown ${USERNAME}:${USERNAME} -R /home/${USERNAME}/.venv \
&& chown ${USERNAME}:${USERNAME} /home/${USERNAME}/.bashrc
RUN mkdir /data
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& uv cache clean
&& uv cache clean
USER ubuntu
# Install DuckDB
RUN mkdir -p ~/.local/bin \
&& curl https://install.duckdb.org | sh