Skip to content

Commit 85ea63d

Browse files
committed
fix(deploy): try to fix runtime error (missing prisma stuff)
1 parent f9af7fe commit 85ea63d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH="${CHROME_BIN}"
3838
# This one is required by Wappalyzer to launch the browser (ref: `node_modules/wappalyzer/driver.js`)
3939
ENV CHROMIUM_BIN="${CHROME_BIN}"
4040

41-
# Cache "npx" dependencies to start faster
41+
# Install Prisma globally to run `prisma migrate deploy` at start
42+
# while used at runtime since the Next.js application is standalone (no node_modules)
4243
RUN npm install -g "prisma@${PRISMA_VERSION}"
4344

45+
# Make the globally-installed packages resolvable
46+
ENV NODE_PATH="/usr/local/lib/node_modules"
47+
4448
# Restrict the permissions
4549

4650
RUN addgroup --system --gid 800 nodejs
@@ -89,5 +93,4 @@ EXPOSE $PORT
8993
# Needed to handle signals properly (due to PID 1)
9094
ENTRYPOINT ["dumb-init", "--"]
9195

92-
# We use `npx` to avoid using `npm run db:migration:deploy:unsecure` since we build as standalone the entire application and we no longer want to rely application `node_modules` folder
93-
CMD ["bash", "-c", "npx --yes prisma@${PRISMA_VERSION} migrate deploy && exec ./start-and-wait-to-init.sh"]
96+
CMD ["bash", "-c", "prisma migrate deploy && exec ./start-and-wait-to-init.sh"]

0 commit comments

Comments
 (0)