How to use t3-oss/env-nextjs without having to rebuild everything just for env variable change

Im strugling another hour soo maybe someone here will help me understand. I have something like this:
export const env = createEnv({
server: {},
client: {
NEXT_PUBLIC_BETTER_AUTH_URL: z.string().url(),
},
runtimeEnv: {
NEXT_PUBLIC_BETTER_AUTH_URL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL,
},

// skip validation for CI and lint
skipValidation: !!process.env.CI || process.env.npm_lifecycle_event === "lint",
});
export const env = createEnv({
server: {},
client: {
NEXT_PUBLIC_BETTER_AUTH_URL: z.string().url(),
},
runtimeEnv: {
NEXT_PUBLIC_BETTER_AUTH_URL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL,
},

// skip validation for CI and lint
skipValidation: !!process.env.CI || process.env.npm_lifecycle_event === "lint",
});
I want to be able to create 1 docker image for this app, but host it under 2 diffrent hostnames. The problem is: NEXT_PUBLIC_BETTER_AUTH_URL is set during build and I cant change it after that. What can I do? Is there only option to create multiple docker images with diffrent configuration?
2 Replies
DomsoN
DomsoN5mo ago
Try building two different containers with different envs (fast idea before sleep)
Killrog
KillrogOP5mo ago
After sleeping i had new idea: Dont use docker images, Use nix with coolify to build images before each deployment

Did you find this page helpful?