docker icon indicating copy to clipboard operation
docker copied to clipboard

Changing build-time env variables to run-time only

Open gabidb opened this issue 2 years ago • 0 comments

What does this PR do?

Fixes [CAL-2635] by changing build-time environment variables to run-time.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

Scenario 1: Verify Image Build and Container Run

  • Build the image with (here you can see the logs): docker build --build-arg DATABASE_URL="postgresql://postgres:@host.docker.internal:5432/calendso" -t calcom-image-test .

  • Run a container using the image with runtime variables: docker run \ -e NEXTAUTH_SECRET="your_secret" \ -e DA TABASE_URL="your_database_url" \ -e CALENDSO_ENCRYPTION_KEY="your_key" \ -e NEXT_PUBLIC_WEBAPP_URL="http://localhost:3000" calcom-image-test

  • Expected Outcome: The container should start successfully with the provided variables. Test with invalid data to verify failure at runtime.

Scenario 2: Docker Compose

  • Start the setup using: docker compose up -d

Disclaimer

At this point Build arguments cannot be removed as there are checks in the background for the existence of these variables. While this makes sense when setting those variables build-time, when requiring the variables to be set only run-time, these checks might be redundant.

gabidb avatar Dec 03 '23 10:12 gabidb