feat(docker:dev): npm dependencies are installed when container starts

This commit is contained in:
Herculino Trotta
2026-07-17 21:29:45 -03:00
parent 5a80a3b1d3
commit 75f23168ab
2 changed files with 16 additions and 3 deletions
+3 -3
View File
@@ -3,9 +3,9 @@ FROM node:lts-alpine
WORKDIR /usr/src/frontend
COPY ./frontend/package.json ./frontend/package-lock.json ./
RUN npm ci --verbose && npm cache clean --force
COPY ./docker/dev/vite/entrypoint.sh /usr/local/bin/vite-entrypoint
RUN chmod +x /usr/local/bin/vite-entrypoint
ENV PATH ./node_modules/.bin/:$PATH
CMD ["npm", "run", "dev"]
ENTRYPOINT ["vite-entrypoint"]
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -eu
deps_hash="$(sha256sum package.json package-lock.json | sha256sum | cut -d ' ' -f 1)"
deps_stamp="node_modules/.wygiwyh-deps-hash"
if [ ! -f "$deps_stamp" ] || [ "$(cat "$deps_stamp")" != "$deps_hash" ]; then
echo "Installing frontend dependencies..."
npm ci --no-audit --no-fund --prefer-offline
printf '%s\n' "$deps_hash" > "$deps_stamp"
fi
exec npm run dev