R
Railwayβ€’4mo ago
Sang Dang

Help deploy with Dockerfile

I'm trying to dockerize my app, voi, and after adding Dockerfile into my git repo, Railway automatically pick it as main builder. I don't know why now it can not "see" the environment variables I have set in Railway project. It works well before when I build from github repo. The Dockerfile: https://github.com/getsieutoc/voi/blob/master/Dockerfile
GitHub
voi/Dockerfile at master Β· getsieutoc/voi
Minimalist self-hosted customer feedback management system - getsieutoc/voi
19 Replies
Percy
Percyβ€’4mo ago
Project ID: 630f2dde-3530-473f-8c82-5dd7fd43d7a7
Sang Dang
Sang Dangβ€’4mo ago
630f2dde-3530-473f-8c82-5dd7fd43d7a7
ebitybatata
ebitybatataβ€’4mo ago
I'm running into the same issue as well!
Brody
Brodyβ€’4mo ago
sang, list every variable you need available at build time please you might be, but this is still a highly specific to his project question, could you instead open your own #βœ‹ο½œhelp thread please?
Sang Dang
Sang Dangβ€’4mo ago
Hi Brody, I feel like we have similar issue. Currently my app need (values are fake)
NEXTAUTH_SECRET=topsecret
NEXTAUTH_URL=https://yourdomain.com
DATABASE_URL=postgres://....

SMTP_USER=yoursmtpuser
SMTP_PASSWORD=yoursmtppass
SMTP_HOST=yoursmtpserver
SMTP_PORT=587
NEXTAUTH_SECRET=topsecret
NEXTAUTH_URL=https://yourdomain.com
DATABASE_URL=postgres://....

SMTP_USER=yoursmtpuser
SMTP_PASSWORD=yoursmtppass
SMTP_HOST=yoursmtpserver
SMTP_PORT=587
But when it builds, it shows the first error message:
#16 66.13 Error: NEXTAUTH_SECRET variable is not defined
#16 66.13 Error: NEXTAUTH_SECRET variable is not defined
which is not correct because I have all and building by using github source code is ok before
Brody
Brodyβ€’4mo ago
it is correct, its not defined, you need to define it in your dockerfile ARG NEXTAUTH_SECRET but i think you where misinterpreting what i said, it would be great if voi could deploy from a docker image, not a repo with a dockerfile
Sang Dang
Sang Dangβ€’4mo ago
ok my bad πŸ™ˆ but I have docker image, let me grab a link for you
Brody
Brodyβ€’4mo ago
of course you still need a Dockerfile to prebuild an image, but you also need to make your app read the NEXTAUTH_SECRET during runtime so that the user can supply it
Sang Dang
Sang Dangβ€’4mo ago
https://hub.docker.com/r/sieutoc/voi/tags I just include that file into my source code at the same time
Brody
Brodyβ€’4mo ago
cool now use that image in your template instead of a repo
Sang Dang
Sang Dangβ€’4mo ago
thanks, I will add the ARG and try again πŸ™
Brody
Brodyβ€’4mo ago
please take note of this
Sang Dang
Sang Dangβ€’4mo ago
look like it works πŸ˜„
Brody
Brodyβ€’4mo ago
right but dont you want the user to specify that? if you are baking it into your image then thats no good
Sang Dang
Sang Dangβ€’4mo ago
hmmm I dont understand what do you mean, I added only
ARG NEXTAUTH_SECRET
ARG NEXTAUTH_URL
ARG DATABASE_URL
ARG EMAIL_FROM
ARG SMTP_USER
ARG SMTP_PASSWORD
ARG SMTP_HOST
ARG SMTP_PORT
...
ARG NEXTAUTH_SECRET
ARG NEXTAUTH_URL
ARG DATABASE_URL
ARG EMAIL_FROM
ARG SMTP_USER
ARG SMTP_PASSWORD
ARG SMTP_HOST
ARG SMTP_PORT
...
to the top of the Dockerfile and redeploy, Railway made it just work...
Brody
Brodyβ€’4mo ago
but you want to use an image in your template
Sang Dang
Sang Dangβ€’4mo ago
in the build log it says like this, so I guess it use the Dockerfile?
No description
Brody
Brodyβ€’4mo ago
right but you want the template to deploy voi from an image
Sang Dang
Sang Dangβ€’4mo ago
ahhhh the template damn I need coffeeeeee I will fix and test with it