feat(infra): went back to alpine and removed package.json merging
- Actually using pnpm workspace... - Use alpine on both runner and builder container - runner using lockfile generated by builder container
This commit is contained in:
parent
c633200e86
commit
f62f21ee18
3 changed files with 17 additions and 38 deletions
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import fs from 'node:fs/promises'
|
||||
|
||||
const merge_json = (prev, cur) => {
|
||||
const keys = ["dependencies", "devDependencies"];
|
||||
const out = {};
|
||||
|
||||
for (let k of keys)
|
||||
out[k] = Object.assign(prev[k] ?? {}, cur[k] ?? {});
|
||||
return out;
|
||||
};
|
||||
|
||||
const promises = process.argv.slice(2).map(f => fs.readFile(f, { encoding: "utf8" }));
|
||||
const jsons = (await Promise.all(promises)).map(JSON.parse);
|
||||
const deps = jsons.reduce(merge_json, {});
|
||||
|
||||
const out = Object.assign(deps, {
|
||||
private: true,
|
||||
name: "stub",
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(out));
|
||||
|
|
@ -1,23 +1,25 @@
|
|||
FROM guergeiro/pnpm:22-10-slim as builder
|
||||
FROM guergeiro/pnpm:22-10-alpine as builder
|
||||
|
||||
ARG SERVICE
|
||||
|
||||
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
|
||||
COPY @shared/package.json /build/@shared/
|
||||
COPY ${SERVICE}/package.json /build/service/
|
||||
COPY tsconfig.base.json pnpm-workspace.yaml package.json /build/
|
||||
|
||||
RUN pnpm install;
|
||||
RUN pnpm install;
|
||||
|
||||
COPY ./@shared/ /build/@shared/
|
||||
COPY ./${SERVICE}/ /build/service/
|
||||
COPY @shared/ /build/@shared/
|
||||
COPY ${SERVICE}/ /build/service/
|
||||
|
||||
RUN cd /build/service && \
|
||||
pnpm run build:prod && \
|
||||
node /build/@shared/scripts/merge.js /build/*/package.json >/dist/package.json && \
|
||||
cp /build/pnpm-workspace.yaml /dist/pnpm-workspace.yaml;
|
||||
RUN cd /build/service && \
|
||||
pnpm run build:prod && \
|
||||
mkdir -p /dist/@shared /dist/service && \
|
||||
cp /build/pnpm-workspace.yaml /dist/pnpm-workspace.yaml && \
|
||||
cp /build/@shared/package.json /dist/@shared/ && \
|
||||
cp /build/service/package.json /dist/service/ && \
|
||||
cp /build/package.json /dist/ && \
|
||||
cp /build/pnpm-lock.yaml /dist/;
|
||||
|
||||
|
||||
FROM guergeiro/pnpm:22-10-alpine
|
||||
|
|
@ -26,6 +28,6 @@ WORKDIR /src
|
|||
|
||||
COPY --from=builder /dist /src
|
||||
|
||||
RUN pnpm install --prod;
|
||||
RUN pnpm install --prod --frozen-lockfile;
|
||||
CMD ["node", "/src/run.cjs"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
pacakges:
|
||||
packages:
|
||||
- ./*
|
||||
|
||||
nodeLinker: hoisted
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue