Help with env variables
Hey all. This is my first time working with docker and I can't get the enviornment variables to work with my sveltekit project. For refrence, here is the docker:
Here is the error I get
Please help
43 Replies
Project ID:
94911b1f-964d-4305-9412-64feedd98d6e
94911b1f-964d-4305-9412-64feedd98d6e
this may help you
https://docs.railway.app/deploy/dockerfiles#environment-variables
Should I provide an ARG for NODE_ENV or PORT?
for PORT, no, since it's not used in the build stage
for NODE_ENV, yes, it would be used during build
Im still a little confused. From the screenshot I provided could you help edit my docker file?
did you read the docs section I linked?
Yes
and what are you confused about exactly?
I'll do it for you, but that's not the best method of learning
So you don't specify arg, you just say arg exists
So that when you call docker with args it takes them in?
this is what I have. I need to specify the node env and port right?
^
I would also put the ARG and ENV stuff directly after the FROM directive
so this?
again, you don't need to specify the PORT
^
so I don't need to include port anywhere
that is what I have said 4 times now
My bad
no worries
well how did it go?
Well my build kept stopping at transforming so I used a differnt docker container and that didn't work either
I've been through a few docker containers and there seems to be a slight problem on all of them that doesn't allow me to fully build and work them
thats a problem with your code, not the docker image you are using
But I can build it fine, and before when i was just using nixpacks it worked fine
I only started using docker containers because I didn't like having to change the
settings:
autoInstallPeers: true
in my pnpm file
so use nixpacks again?
I saw your comment about manually using docker containers so I decided to give it a try
I think I'm going to stick with nixpacks until I can get a fully working docker container
only if there's a good enough reason, what's your reason?
My reason is that I don't like changing a line in a file every time I install a new package lol but I also just wanted to learn docker
then I'd recommend using docker locally
Yea you are probably right
Thanks for the help though, that got me through half of my docker problems haha
no problem!
Is there a way to delete build cache?
I think I completely screwed over my server from those docker builds. Ive never seen this before but look at my builds now even with nixpacks.
I reverted my github to the last commit that worked fine
NIXPACKS_NO_CACHE
https://nixpacks.com/docs/configuration/environment
so in nixpakcs.toml:
no
in a service variable
oohhhh
yea I understand
No way
Only in programming does something work, then not work when I make a change, then still not work when I revert that change
have you tried running nixpacks and docker locally
nope, but I've never had to
and now you do!
Bruh. It was a single console.log
A single console.log of my prisma.users.findMany()
so all good now?
And that single console.log ended up allocating 139terabytes of ram
Yea
Nodejs can be so strange
Solution
well at least I was right about it being a code issues haha
yep
glad you've solved it!
lmao that's what you mark
Thanks man! That was seriously a journey through learning docker to running nixpacks locally
All to find out it was a single console.log
programming is werid