Skip to content

Commit

Permalink
NodeJS in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
covracer committed Nov 7, 2024
1 parent 4bcd09e commit 1bb9759
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 124 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repos:
- --write-changes
- id: dot-yaml
- id: gitignore-node-python
- id: hadolint
- id: includes-sh
- id: mailmap
- id: mypy
Expand Down
22 changes: 19 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@ FROM python:3.12
# TODO assert C.UTF8 and PYTHONUNBUFFERED are set correctly

WORKDIR /srv
RUN --mount=type=cache,target=/root/.cache pip install --upgrade pip-tools wheel

COPY includes.sh .
# hadolint ignore=SC2086
RUN --mount=type=cache,target=/var/cache/apt \
rm /etc/apt/apt.conf.d/docker-clean \
&& source includes.sh \
&& apt-get update \
&& apt-get install --no-install-recommends --quiet --quiet --yes \
&& nodejs $PACKAGES \
&& rm -rf /var/lib/apt/lists/*

COPY package-lock.json .
RUN --mount=type=cache,target=/root/.npm \
npm install --frozen-lockfile

COPY requirements.txt .
RUN --mount=type=cache,target=/root/.cache pip-sync
# hadolint ignore=DL3013,DL3042
RUN --mount=type=cache,target=/root/.cache \
pip install --disable-pip-version-check --upgrade $(grep ^uv requirements.txt) \
&& uv pip sync requirements.txt

# TODO multi-stage for faster development builds?
RUN mkdir -p static

COPY . .
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ services:
proxy:
image: cloudflare/cloudflared:2024.2.1

lab:
build: .
command: python -m manage shell_plus --allow-root
hub:
command: PATH="node_modules/.bin:$PATH" python -m jupyterhub
depends_on:
- postgres
environment:
Expand Down
3 changes: 2 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pre-commit
codespell
git+https://github.com/AleksaC/hadolint-py.git
mypy
ruff
shellcheck-py
Expand All @@ -21,7 +22,7 @@ requests
# Development tools, build-time dependencies
build
django-stubs
djangorestframework-stubs[compatible-mypy]
djangorestframework-stubs
pre-commit
pytest
pytest-django
Expand Down
Loading

0 comments on commit 1bb9759

Please sign in to comment.