chore(web-player): tighten the container image

There was no .dockerignore, so node_modules and build/ were copied into the
build context on every build. Add one, install from the lockfile with npm ci,
prune the dev dependencies out of the runtime layer and run as the node user.
This commit is contained in:
2026-07-20 15:14:04 +02:00
parent b4385d9028
commit cea0dbffa4
2 changed files with 16 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
node_modules
build
.svelte-kit
.env
.env.*
!.env.example
.git
.github
.claude
.vscode
docs
*.md
+4 -3
View File
@@ -2,16 +2,17 @@
FROM node:22-alpine AS build FROM node:22-alpine AS build
WORKDIR /src WORKDIR /src
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN npm install RUN npm ci
COPY . . COPY . .
RUN npm run build RUN npm run build && npm prune --omit=dev
FROM node:22-alpine AS runtime FROM node:22-alpine AS runtime
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ENV PORT=3000
COPY --from=build /src/build ./build COPY --from=build /src/build ./build
COPY --from=build /src/node_modules ./node_modules COPY --from=build /src/node_modules ./node_modules
COPY --from=build /src/package.json ./package.json COPY --from=build /src/package.json ./package.json
USER node
EXPOSE 3000 EXPOSE 3000
ENV PORT=3000
CMD ["node", "build/index.js"] CMD ["node", "build/index.js"]