diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9ba645a5..7a00460b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -8,6 +8,7 @@ RUN set -eux; \ curl \ ca-certificates \ xz-utils \ + git \ openssh-client \ ; \ rm -rf /var/lib/apt/lists/* @@ -45,10 +46,19 @@ RUN case "$(uname -m)" in \ # Setup poetry without virtual environments so that dependencies persist to a mounted BuildingMOTIF workspace ENV POETRY_VIRTUALENVS_IN_PROJECT=FALSE ENV POETRY_VIRTUALENVS_CREATE=FALSE +# Don't Generate Pycache that will make the image bigger +ENV PYTHONDONTWRITEBYTECODE=TRUE + RUN set -eux; \ python -m pip install poetry; \ rm -rf ~/.cache/pip +# Setup angular and install dependencies globally +RUN set -eux; \ + npm install -g @angular/cli@17; \ + echo "source <(ng completion script)" > /root/.bashrc; \ + rm -rf ~/.npm/_cacache + COPY pyproject.toml pyproject.toml COPY poetry.lock poetry.lock @@ -66,10 +76,13 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/*; \ rm -rf ~/.cache/pypoetry/cache ~/.cache/pypoetry/artifacts -# Setup angular and install dependencies globally +WORKDIR /workspaces/BuildingMOTIF + +COPY .pre-commit-config.yaml . RUN set -eux; \ - npm install -g @angular/cli@17; \ - echo "source <(ng completion script)" > /root/.bashrc; \ - rm -rf ~/.npm/_cacache + git init; \ + pre-commit; \ + rm -rf ~/.cache/pip ~/.local/share/virtualenv -WORKDIR /workspaces/BuildingMOTIF +# Byte Code can be generated by the user +ENV PYTHONDONTWRITEBYTECODE= diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 54b04953..3e33e954 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,8 +6,11 @@ }, "runArgs": ["--net=host"], // Use host network for webapp (which only listens for localhost by default) "features": { - "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}, - "ghcr.io/devcontainers/features/git:1": {} + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} + }, + "postCreateCommand": { + "pre-commit":"pre-commit install", + "poetry install": "poetry install --all-extras" }, "customizations": { "vscode": {