mirror of
https://github.com/dataforcanada/d4c-datapkg-statistical.git
synced 2026-06-13 14:10:55 +02:00
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:
@@ -3,6 +3,7 @@
|
||||
"dockerComposeFile": "../docker-compose.yml",
|
||||
"service": "devcontainer",
|
||||
"workspaceFolder": "/workspace",
|
||||
"containerUser": "ubuntu",
|
||||
"shutdownAction": "stopCompose",
|
||||
"forwardPorts": [
|
||||
5432,
|
||||
@@ -14,13 +15,15 @@
|
||||
"ms-python.python",
|
||||
"ms-toolsai.jupyter",
|
||||
"vsls-contrib.gistfs",
|
||||
"vscode-icons-team.vscode-icons",
|
||||
"dorzey.vscode-sqlfluff"
|
||||
"vscode-icons-team.vscode-icons"
|
||||
],
|
||||
"settings": {
|
||||
"python.pythonPath": "/root/.venv/bin/python",
|
||||
"python.defaultInterpreterPath": "/root/.venv/bin/python"
|
||||
"python.pythonPath": "/home/ubuntu/.venv/bin/python",
|
||||
"python.defaultInterpreterPath": "/home/ubuntu/.venv/bin/python"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mounts": [
|
||||
"source=${localEnv:HOME}/.ssh,target=/home/ubuntu/.ssh,type=bind,consistency=cached"
|
||||
]
|
||||
}
|
||||
+24
-9
@@ -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
|
||||
Reference in New Issue
Block a user