Issue deploying nodejs express backend

Hi there, I have a standard nodejs express backend and Im trying to deploy it on flyio.

I did fly launch, but it gave me this error

Before creating it, I did a dockerfile as such

RUN apt-get update && apt-get install -y openssl libssl-dev ca-certificates


COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json


RUN npm install

COPY . /app

RUN --mount=type=secret,id=db_secret \
  DATABASE_URL="$(cat ./secrets/postgres_connection_string)" \
  npx prisma migrate deploy \
  && npx prisma generate

CMD [ "npm", "run", "start" ]`Preformatted text`

type or paste code here

Now, from my previous times deploying on flyio, after doing fly launch, it returns me a databaseURL. I need to copy the databaseURL, make a secrets/postgress_connection_string file and paste it there, and then run the fly secrets set , and then finally fly deploy.

But yeah, I’m getting an error when I do fly launch, and I’ve been cracking my head on how to resolve this.

If anyone could give me guidance, it would be much appreciated, thanks!

My guess is that this is present in your .gitignore file, was therefore copied to your .dockerignore file, and therefore isn’t present in the docker image. If my guess is correct, remove it from your .dockerignore. You can (and should) leave that line in your .gitignore.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.