jonluca / vite-typescript-ssr-react

🚀 A Vite Typescript SSR React boilerplate!
https://blog.jonlu.ca/posts/vite
342 stars 48 forks source link

Dev dependecies in Docker #30

Open adamtretera opened 5 months ago

adamtretera commented 5 months ago

So when I try to build a docker image with this

FROM node:20-bookworm-slim as builder

WORKDIR /app

COPY package.json yarn.lock ./

RUN yarn install --no-cache --frozen-lockfile

ENV NODE_ENV=production

COPY . .

RUN yarn build && yarn install --no-cache  --ignore-scripts --prefer-offline

FROM node:20-bookworm-slim AS runner

WORKDIR /app

RUN addgroup --gid 1001 --system nodejs

COPY --chown=1001:1001 --from=builder /app /app

USER favdog

ENV NODE_ENV=production

CMD ["node", "./dist/server.js"]

Nothing to fancy I would say - but am getting error on the dev dependecnies not present in the is it becasue the docker should contain just the files builded by vite ?
but inside the server.ts there is also used vite - createServer which is also rightfully dev dependency ?

I wanna run docker image in prod mode