Env import in `next.config.mjs` for Docker Image
Hey, in the docs of create-t3-app it states that I should remove the
import { env } from "./src/env/server.mjs";
when deploying with Docker. How exactly am I able to do this only for production? Because I'd like to keep it for development to check env vars.9 Replies
dynamic imports maybe? the idea would be to import it and assign it to process.env if you're in development mode else do nothing. iirc process.env is immutable
or wait even better just have that value pull from process.env in server.mjs if it's in prod
Good question, and I don't think ct3a currently has an answer for this. Could you open an issue?
I've been meaning to write the docs for a dev docker setup with hmr etc, which at least would make it so that you can use the same files in dev and prod. But of course the ideal situation would be that you can develop locally in dev and then deploy to a container.
Sure, will do
also will look into it, will most likely need it on my company by the end of this week LMAO
nice, you're using ct3a in prod?
Yep sir, shipping this month hopefully
any help with this is appreciated - i wrote most of the current docker docs, but i hate debugging docker stuff
😅
I gotta say it's nothing really huge though, most of the backend part is literally nothing. Mostly made it to get my co-workers to like NextJS and get them into better stuff than what we currently use
Going flawless so far
I usually have to fight with Docker and Rancher, I can provide more info once I look into this
GitHub
feat: improve docker setup · Issue #603 · t3-oss/create-t3-app
Is your feature request related to a problem? Please describe. Currently in the docs it states that I should remove the import { env } from "./src/env/server.mjs"; when deploying ...
maybe a bit too general idk