Skip to content

Conversation

@giuliobracci
Copy link

This PR fixes the staging Dockerfile to use the correct environment file during the build process.

The staging Dockerfile was incorrectly copying .env.staging.sample to .env.production instead of .env.staging. This caused the staging environment to use production environment variable names/structure, which could lead to configuration mismatches and potential runtime errors in the staging environment.

Changed line 28 in examples/with-docker-multi-env/docker/staging/Dockerfile from:

COPY .env.staging.sample .env.production

to:

COPY .env.staging.sample .env.staging

This commit fixes the `Dockerfile` using the wrong .env
@ijjk ijjk added the examples Issue was opened via the examples template. label Oct 24, 2025
@ijjk
Copy link
Member

ijjk commented Oct 24, 2025

Allow CI Workflow Run

  • approve CI run for commit: 6a09c49

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments:

examples/with-docker-multi-env/docker/development/Dockerfile (line 27):
The development Dockerfile has the same bug that was just fixed in the staging Dockerfile: it copies .env.development.sample to .env.production instead of .env.development, causing the development environment to use production environment variable names and structure.

View Details
📝 Patch Details
diff --git a/examples/with-docker-multi-env/docker/development/Dockerfile b/examples/with-docker-multi-env/docker/development/Dockerfile
index 5f7dc5d0fc..c63a854bfc 100644
--- a/examples/with-docker-multi-env/docker/development/Dockerfile
+++ b/examples/with-docker-multi-env/docker/development/Dockerfile
@@ -24,7 +24,7 @@ WORKDIR /app
 COPY --from=deps /app/node_modules ./node_modules
 COPY . .
 # This will do the trick, use the corresponding env file for each environment.
-COPY .env.development.sample .env.production
+COPY .env.development.sample .env.development
 RUN npm run build
 
 # 3. Production image, copy all the files and run next

Analysis

Development Dockerfile copies to wrong environment file

What fails: Development Docker build (examples/with-docker-multi-env/docker/development/Dockerfile, line 27) copies .env.development.sample to .env.production instead of .env.development, causing the container to load production environment variable names during the build process.

How to reproduce:

cd examples/with-docker-multi-env
docker build -f docker/development/Dockerfile -t dev-app .
docker run dev-app cat .env

Result: The .env file inside the container contains production environment variable structure instead of development structure, mismatching the intended environment configuration.

Expected: Should copy to .env.development to match the environment name, consistent with staging Dockerfile (COPY .env.staging.sample .env.staging) and production Dockerfile (COPY .env.production.sample .env.production).

Pattern inconsistency: All three environment Dockerfiles should follow the same pattern:

  • Production: COPY .env.production.sample .env.production
  • Staging: COPY .env.staging.sample .env.staging
  • Development: COPY .env.development.sample .env.production ✗ (should be .env.development)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples Issue was opened via the examples template.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants