Skip to content

Commit

Permalink
add pre-commit and reorganize dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
TShapinsky committed Nov 1, 2024
1 parent c7b7c51 commit e400ff5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
23 changes: 18 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN set -eux; \
curl \
ca-certificates \
xz-utils \
git \
openssh-client \
; \
rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -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

Expand All @@ -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=
7 changes: 5 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit e400ff5

Please sign in to comment.