Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
ARG NODE_VERSION=26.13.1
FROM node:${NODE_VERSION}-alpine AS dependencies
FROM node:${NODE_VERSION}-alpine AS tooling
RUN apk add --no-cache openssl ca-certificates \
&& npm install --global pnpm@11.21.0
WORKDIR /app
COPY deploy/certs/us-east-1-bundle.pem /app/deploy/certs/us-east-1-bundle.pem
ENV NODE_EXTRA_CA_CERTS=/app/deploy/certs/us-east-1-bundle.pem
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY tools ./tools
RUN pnpm install --frozen-lockfile
COPY deploy/migrate/package.json ./deploy/migrate/package.json

FROM tooling AS dependencies
RUN pnpm --filter @topcoder/forms-api-v6 install --frozen-lockfile

FROM dependencies AS build
COPY . .
Expand All @@ -16,6 +19,10 @@ RUN pnpm lint && pnpm build && pnpm typecheck && pnpm test && pnpm test:dependen
FROM dependencies AS production-dependencies
RUN pnpm prune --prod

FROM tooling AS migration-dependencies
RUN pnpm --filter @topcoder/forms-migrations install --prod --frozen-lockfile \
--virtual-store-dir=/app/deploy/migrate/node_modules/.pnpm

FROM alpine:3.24 AS runtime-base
ARG NODE_VERSION
ENV NODE_ENV=production
Expand All @@ -30,7 +37,7 @@ USER app

# One-shot migration image; invoke the installed CLI without shipping npm/pnpm.
FROM runtime-base AS migrate
COPY --from=build --chown=app:app /app/node_modules ./node_modules
COPY --from=migration-dependencies --chown=app:app /app/deploy/migrate/node_modules ./node_modules
COPY --chown=app:app package.json prisma.config.ts ./
COPY --chown=app:app prisma ./prisma
CMD ["node", "node_modules/prisma/build/index.js", "migrate", "deploy"]
Expand Down
8 changes: 8 additions & 0 deletions deploy/migrate/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@topcoder/forms-migrations",
"private": true,
"dependencies": {
"dotenv": "17.2.3",
"prisma": "7.10.1"
}
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
packages:
- deploy/migrate

allowBuilds:
'@prisma/engines': true
'@swc/core': true
Expand Down
Loading