feat(infra): reworked Dockerfile
- changed from npm to pnpm in Dockerfile => improved install time
Fixed errors from change in .ts files.
This commit is contained in:
parent
704ce37909
commit
5f9fd5629c
7 changed files with 51 additions and 35 deletions
|
|
@ -1,29 +1,34 @@
|
|||
FROM node:24-alpine as builder
|
||||
FROM guergeiro/pnpm:22-10-alpine as builder
|
||||
|
||||
RUN apk add jq;
|
||||
ARG SERVICE
|
||||
|
||||
RUN apk add jq python3 musl-dev gcc g++ make;
|
||||
|
||||
WORKDIR /build
|
||||
COPY ./@shared/package.json /build/@shared/package.json
|
||||
COPY ./${SERVICE}/package.json /build/service/package.json
|
||||
COPY ./${SERVICE}/package.json /build/package.json
|
||||
COPY ./tsconfig.base.json /build/tsconfig.base.json
|
||||
COPY ./pnpm-workspace.yaml /build/pnpm-workspace.yaml
|
||||
|
||||
RUN echo "{\"name\":\"workspace\", \"workspaces\": [\"@shared\", \"${SERVICE}\" ]}" | jq . >/build/package.json;
|
||||
RUN npm install && npm install --prefix=/build/service;
|
||||
RUN pnpm install;
|
||||
RUN ls -a *;
|
||||
|
||||
COPY ./@shared/ /build/@shared/
|
||||
COPY ./${SERVICE}/ /build/service/
|
||||
|
||||
RUN (cd /build/service && npm run build:prod) \
|
||||
&& jq -s '.[0] * .[1]' /build/@shared/package.json /build/service/package.json >/dist/package.json;
|
||||
RUN cd /build/service && \
|
||||
pnpm run build:prod && \
|
||||
jq -s '.[0] * .[1]' /build/*/package.json >/dist/package.json && \
|
||||
cp /build/pnpm-workspace.yaml /dist/pnpm-workspace.yaml && \
|
||||
true;
|
||||
|
||||
FROM node:24
|
||||
|
||||
FROM guergeiro/pnpm:22-10-slim
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY --from=builder /dist /src
|
||||
|
||||
RUN npm install;
|
||||
RUN pnpm install --prod;
|
||||
CMD ["node", "/src/run.cjs"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue