Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deps): install project and dev and test dependencies in devcontainer #10544

Merged
merged 14 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
FROM mcr.microsoft.com/vscode/devcontainers/python:3.11
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ARG USERNAME=vscode

RUN apt-get update && \
apt-get install -y --no-install-recommends libgdal-dev
apt-get install -y --no-install-recommends libgdal-dev && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1

# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy

COPY . /app

# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --group dev --group tests \
--extra duckdb --extra clickhouse --extra examples --extra geospatial

ENV VENV_DIR=.venv
RUN chown -R $USERNAME $VENV_DIR && chmod -R 755 $VENV_DIR

ENV HYPOTHESIS_EXAMPLE_DB_DIR=.hypothesis
RUN chown -R $USERNAME $HYPOTHESIS_EXAMPLE_DB_DIR && chmod -R 755 $HYPOTHESIS_EXAMPLE_DB_DIR

ENV PYTEST_CACHE=.pytest_cache
RUN chown -R $USERNAME $PYTEST_CACHE && chmod -R 755 $PYTEST_CACHE

# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"

ENTRYPOINT []

USER $USERNAME
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"build": { "dockerfile": "Dockerfile" },
"postCreateCommand": ".devcontainer/postCreate.sh",
"build": { "dockerfile": "Dockerfile", "context": ".." },
"containerUser": "vscode",
"remoteUser": "vscode",
"customizations": {
"codespaces": {
"openFiles": ["docs/tutorials/getting_started.qmd"]
Expand Down
Loading