Skip to content

Dev dependecies in DockerΒ #30

@adamtretera

Description

@adamtretera

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions