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
mey
mey•3y ago
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
cje
cje•3y ago
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.
Nestor
NestorOP•3y ago
Sure, will do also will look into it, will most likely need it on my company by the end of this week LMAO
cje
cje•3y ago
nice, you're using ct3a in prod?
Nestor
NestorOP•3y ago
Yep sir, shipping this month hopefully
cje
cje•3y ago
any help with this is appreciated - i wrote most of the current docker docs, but i hate debugging docker stuff 😅
Nestor
NestorOP•3y ago
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
Nestor
NestorOP•3y ago
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 ...
Nestor
NestorOP•3y ago
maybe a bit too general idk
Want results from more Discord servers?
Add your server