Skip to content

Commit

Permalink
feat: use corepack and pnpm in dockerfile (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
stickyPiston authored Jun 12, 2024
1 parent dfa8cf5 commit a7f482d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
21 changes: 9 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# syntax=docker/dockerfile:1

FROM node:21-bullseye as base
COPY package.json ./
RUN corepack enable

# --------------------------------------

FROM base AS deps
WORKDIR /deps/dev
COPY package.json ./
RUN npm install
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile

# --------------------------------------

Expand All @@ -18,18 +20,13 @@ COPY . .
COPY .env.production .

ENV NODE_ENV production
RUN npm run build
RUN pnpm run build

# --------------------------------------

FROM base AS prepare
FROM base AS deploy
WORKDIR /app
RUN npm install -g serve

# --------------------------------------

FROM prepare AS deploy
COPY --from=build /app/dist /app/dist
ENV NODE_ENV production
COPY --from=build /app/dist /app/dist
ENV NODE_ENV production

CMD ["serve", "-s", "dist", "-l", "4201"]
CMD ["pnpm", "dlx", "serve", "-s", "dist", "-l", "4201"]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@
"workerDirectory": [
"public"
]
}
},
"packageManager": "[email protected]+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631"
}

0 comments on commit a7f482d

Please sign in to comment.