-
Notifications
You must be signed in to change notification settings - Fork 0
Build / security fixes, Prisma updates to run migrations on deploy, and add new subcontractingEndCustomer field to billing accounts to be loaded from Salesforce. #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ba1db2d
0dd6f2b
8289e1d
5dbe25f
27c3e29
db65b6a
a19d794
0a12d77
c1e7b85
c4cc144
1f37944
885be56
50d0789
d9cc07d
ecce205
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,31 @@ | ||
| # ---- Base Stage ---- | ||
| FROM node:20-alpine AS base | ||
| FROM node:22.19-alpine AS base | ||
| RUN apk add --no-cache openssh-client git openssl | ||
| WORKDIR /usr/src/app | ||
|
|
||
| # ---- Dependencies Stage ---- | ||
| FROM base AS deps | ||
| # Install pnpm | ||
| RUN npm install -g pnpm | ||
| # Copy dependency-defining files | ||
| COPY package.json pnpm-lock.yaml ./ | ||
| # Install dependencies | ||
| RUN pnpm install --frozen-lockfile --prod | ||
| RUN pnpm install --frozen-lockfile | ||
|
|
||
| # ---- Build Stage ---- | ||
| FROM base AS build | ||
| RUN npm install -g pnpm | ||
| COPY --from=deps /usr/src/app/node_modules ./node_modules | ||
| FROM deps AS build | ||
| COPY . . | ||
| # Build the application | ||
| # Build the application (runs prisma generate via package script) | ||
| RUN pnpm build | ||
|
|
||
| # ---- Production Stage ---- | ||
| FROM base AS production | ||
| ENV NODE_ENV=production | ||
| # Install OpenSSL runtime (provides libssl.so.3 for Prisma musl OpenSSL 3) | ||
| RUN apk add --no-cache openssl | ||
| # Copy built application from the build stage | ||
| WORKDIR /usr/src/app | ||
|
|
||
| # Copy built artifacts and runtime deps | ||
| COPY --from=build /usr/src/app/dist ./dist | ||
| # Copy production dependencies (including generated Prisma client) from the build stage | ||
| COPY --from=build /usr/src/app/node_modules ./node_modules | ||
| COPY --from=build /usr/src/app/prisma ./prisma | ||
| COPY --from=build /usr/src/app/entrypoint.sh /entrypoint.sh | ||
|
|
||
| # Expose the application port | ||
| EXPOSE 3000 | ||
| RUN chmod +x /entrypoint.sh | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
|
|
||
| # The command to run the application | ||
| CMD ["node", "dist/main.js"] | ||
| ENTRYPOINT ["/entrypoint.sh"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/bin/sh | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
|
|
||
| set -e | ||
|
|
||
| echo "Starting Billing Accounts API v6..." | ||
|
|
||
| # Run database migrations | ||
| # Prisma uses PostgreSQL advisory locks to prevent concurrent migrations | ||
| # Only one instance will run migrations, others will wait | ||
|
|
||
| echo "Running database migrations..." | ||
|
|
||
| npx prisma migrate deploy | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| # Check migration status | ||
| if [ $? -eq 0 ]; then | ||
| echo "Migrations completed successfully" | ||
| else | ||
| echo "Migration failed with exit code $?" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Start the application | ||
| echo "Starting application server..." | ||
| exec node /usr/src/app/dist/main.js | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[⚠️
security]Consider verifying whether all added packages (
openssh-client,git,openssl) are necessary for the production environment. Unnecessary packages can increase the image size and potentially introduce security vulnerabilities.