Skip to content

Commit d5f3b11

Browse files
committed
fix(ci): deploy n1 previews from prod image
1 parent 180f58b commit d5f3b11

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

apps/new-engine-ctl/config/stack-inputs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,5 +614,5 @@ service_reconciliation:
614614
- service_id: n1
615615
builder:
616616
build_stage_target_by_lane:
617-
preview: ci-dev
617+
preview: prod
618618
main: prod

docker/development/n1/Dockerfile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ RUN mkdir -p apps/n1/public
4949
RUN --mount=type=cache,id=pnpm-store-n1-ci-dev,target=/tmp/pnpm-store \
5050
corepack install && \
5151
npm_config_store_dir=/tmp/pnpm-store \
52-
pnpm install --store-dir=/tmp/pnpm-store --frozen-lockfile --filter=n1... && \
52+
pnpm install --store-dir=/tmp/pnpm-store --frozen-lockfile --filter=n1... --ignore-scripts && \
5353
pnpm --filter=@techsio/ui-kit build && \
5454
pnpm --filter=@techsio/analytics build && \
55-
pnpm install --store-dir=/tmp/pnpm-store --frozen-lockfile --filter=n1... && \
55+
pnpm install --store-dir=/tmp/pnpm-store --frozen-lockfile --filter=n1... --ignore-scripts && \
5656
rm -rf \
5757
libs/ui/storybook-static \
5858
node_modules/.pnpm/@biomejs+* \
@@ -75,11 +75,9 @@ CMD ["npm", "run", "start:ci-dev"]
7575
# ============================================
7676
FROM base AS build
7777

78-
# Prime pnpm store from lockfile so dependency downloads are cached across source-only changes.
7978
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
80-
RUN --mount=type=cache,id=pnpm-store-n1,target=/pnpm/store \
81-
corepack install && \
82-
pnpm fetch --store-dir=/pnpm/store --frozen-lockfile
79+
RUN node -e "const fs=require('node:fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.pnpm={...(pkg.pnpm||{}), supportedArchitectures:{os:['current'], cpu:['current'], libc:['current']}}; fs.writeFileSync('package.json', JSON.stringify(pkg,null,2)+'\n');"
80+
RUN corepack install
8381

8482
# Reuse the same narrowed copy boundary as ci-dev so unrelated repo changes don't
8583
# invalidate the production dependency and build layers.
@@ -89,8 +87,9 @@ COPY libs/ui ./libs/ui
8987
COPY libs/analytics ./libs/analytics
9088
RUN mkdir -p apps/n1/public
9189

92-
RUN --mount=type=cache,id=pnpm-store-n1,target=/pnpm/store \
93-
pnpm install --store-dir=/pnpm/store --offline --frozen-lockfile --filter=n1... && \
90+
RUN npm_config_store_dir=/var/www/.pnpm-store \
91+
npm_config_package_import_method=hardlink \
92+
pnpm install --store-dir=/var/www/.pnpm-store --frozen-lockfile --filter=n1... --ignore-scripts && \
9493
pnpm --filter=@techsio/ui-kit build && \
9594
pnpm --filter=@techsio/analytics build
9695

@@ -115,11 +114,13 @@ ENV NEXT_PUBLIC_HEUREKA_API_KEY=${NEXT_PUBLIC_HEUREKA_API_KEY}
115114

116115
# Keep this second install: with inject-workspace-packages=true, N1 needs a relink
117116
# after building @techsio/* dist outputs or Next build can resolve stale package state.
118-
RUN --mount=type=cache,id=pnpm-store-n1,target=/pnpm/store \
119-
pnpm install --store-dir=/pnpm/store --offline --frozen-lockfile --filter=n1... && \
117+
RUN npm_config_store_dir=/var/www/.pnpm-store \
118+
npm_config_package_import_method=hardlink \
119+
pnpm install --store-dir=/var/www/.pnpm-store --frozen-lockfile --filter=n1... --ignore-scripts && \
120120
pnpm --filter=n1 exec next typegen && \
121121
pnpm --filter=n1 build && \
122-
test -f apps/n1/.next/BUILD_ID
122+
test -f apps/n1/.next/BUILD_ID && \
123+
rm -rf /var/www/.pnpm-store libs/ui/storybook-static node_modules/.cache
123124

124125
# ============================================
125126
# PROD RUNTIME - minimal final image

0 commit comments

Comments
 (0)