You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to Dockerize my Payload CMS application, but the build process fails with an error stating it couldn't connect to PostgreSQL. Here's an overview of my setup and the issue:
Context
The build stage in my .Dockerfile looks like this:
FROM setup AS builder
WORKDIR /app
# Copy environment variable configuration file, source code, and necessary configuration filesCOPY .env.docker .env
COPY --from=setup /app/node_modules ./node_modules
COPY . .
# Build the applicationRUN corepack enable pnpm && pnpm run build
The .env.docker file contains the following environment variables needed at build time:
PAYLOAD_SECRET
DATABASE_URI
NEXT_PUBLIC_SERVER_URL
Reference
I’m following guidance from this blog: Next.js Runtime Variables, which recommends using environment variables for build-time configuration.
Question
Why is the Payload application trying to connect to PostgreSQL during the build process? Is there a way to bypass the connection step at build time? Or is my approach to handling environment variables for the Payload application in Docker incorrect?
Any guidance or best practices would be greatly appreciated!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I'm trying to Dockerize my Payload CMS application, but the build process fails with an error stating it couldn't connect to PostgreSQL. Here's an overview of my setup and the issue:
Context
build
stage in my.Dockerfile
looks like this:The .env.docker file contains the following environment variables needed at build time:
Reference
I’m following guidance from this blog: Next.js Runtime Variables, which recommends using environment variables for build-time configuration.
Question
Why is the Payload application trying to connect to PostgreSQL during the build process? Is there a way to bypass the connection step at build time? Or is my approach to handling environment variables for the Payload application in Docker incorrect?
Any guidance or best practices would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions