My Google Cloud environment uses a different set of credentials from my local setup. However, when I run the deployment process, my local .env file is still being packaged into the Docker image.
This is unexpected because .env is already listed in my .dockerignore, but it appears to still be copied during the build.
Expected behaviour
The .env file should be excluded from the Docker build context and not included in the final image.
Actual behaviour
The .env file is included in the built image, potentially exposing local credentials.
Question
What could cause .dockerignore to be ignored in this case, and how can I ensure the .env file is fully excluded from the image during build/deploy?
My Google Cloud environment uses a different set of credentials from my local setup. However, when I run the deployment process, my local .env file is still being packaged into the Docker image.
This is unexpected because .env is already listed in my .dockerignore, but it appears to still be copied during the build.
Expected behaviour
The .env file should be excluded from the Docker build context and not included in the final image.
Actual behaviour
The .env file is included in the built image, potentially exposing local credentials.
Question
What could cause .dockerignore to be ignored in this case, and how can I ensure the .env file is fully excluded from the image during build/deploy?