Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I currently have my Dockerfile set to the following
FROM node:17-alpine3.15 As development
WORKDIR /usr/src/app
COPY package*.json ./
COPY prisma ./prisma/
RUN npm install
COPY . .
RUN echo ${DATABASE_URL}
RUN npx prisma migrate deploy
RUN npx prisma generate
RUN npm run build
FROM node:17-alpine3.15 as production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=production
COPY . .
RUN npx prisma generate
COPY --from=development /usr/src/app/dist ./dist
CMD ["node", "dist/main"]
And my App Spec set to:
alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
databases:
- engine: PG
name: db
num_nodes: 1
size: db-s-dev-database
version: "12"
domains:
- domain: xxxxxxxxxxxx.com
type: PRIMARY
- domain: www.xxxxxxxxx.com
type: ALIAS
envs:
- key: DATABASE_URL
scope: RUN_AND_BUILD_TIME
value: ${db.DATABASE_URL}
name: xxxxxxxxxxxxxxx
region: nyc
services:
- dockerfile_path: Dockerfile
github:
branch: master
deploy_on_push: true
repo: xxxxxx/xxxxxxx
http_port: 3000
instance_count: 1
instance_size_slug: basic-xxs
name: xxxxxxxxxxx
routes:
- path: /
source_dir: /
The relevant env var is DATABASE_URL which I have set to the bind-able variable ${db.DATABASE_URL}. When I log into the console and run echo ${DATABASE_URL}, it returns the expected value; however, in the Dockerfile, I have added a line that should do the exact same RUN echo ${DATABASE_URL}. I added this line as a debug step since Prisma has not been able to find the env var during build time.
2022-04-03T18:52:24.065869742Z [36mINFO[0m[0068] cmd: /bin/sh
2022-04-03T18:52:24.065923766Z [36mINFO[0m[0068] args: [-c echo $DATABASE_URL]
2022-04-03T18:52:24.066156470Z [36mINFO[0m[0068] Running: [/bin/sh -c echo $DATABASE_URL]
2022-04-03T18:52:24.070341477Z
2022-04-03T18:52:24.070512989Z [36mINFO[0m[0068] Taking snapshot of full filesystem...
2022-04-03T18:52:26.795716689Z [36mINFO[0m[0070] No files were changed, appending empty layer to config. No layer added to image.
2022-04-03T18:52:26.795753400Z [36mINFO[0m[0070] RUN npx prisma migrate deploy
2022-04-03T18:52:26.795759108Z [36mINFO[0m[0070] cmd: /bin/sh
2022-04-03T18:52:26.795762315Z [36mINFO[0m[0070] args: [-c npx prisma migrate deploy]
2022-04-03T18:52:26.795829343Z [36mINFO[0m[0070] Running: [/bin/sh -c npx prisma migrate deploy]
2022-04-03T18:52:26.805099942Z [36mINFO[0m[0070] Pushing layer <registry-uri-4> to cache now
2022-04-03T18:52:26.806076954Z [36mINFO[0m[0070] Pushing image to <registry-uri-5>
2022-04-03T18:52:30.573795320Z Environment variables loaded from .env
2022-04-03T18:52:30.587384625Z Prisma schema loaded from prisma/schema.prisma
2022-04-03T18:52:30.767634422Z Error: Get config: Schema Parsing P1012
2022-04-03T18:52:30.767658122Z
2022-04-03T18:52:30.767662027Z error: Environment variable not found: DATABASE_URL.
2022-04-03T18:52:30.767666757Z --> schema.prisma:10
2022-04-03T18:52:30.767670924Z |
2022-04-03T18:52:30.767673327Z 9 | provider = "postgres"
2022-04-03T18:52:30.767676852Z 10 | url = env("DATABASE_URL")
2022-04-03T18:52:30.767679481Z |
2022-04-03T18:52:30.767681587Z
2022-04-03T18:52:30.767683994Z Validation Error Count: 1
2022-04-03T18:52:30.767689885Z
2022-04-03T18:52:30.808100760Z error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1
2022-04-03T18:52:30.809647186Z
2022-04-03T18:52:30.809659552Z command exited with code 1
2022-04-03T18:52:33.253784241Z [31m ! Build failed (exit code 1)[0m
Here is the output in the console
I have RUN_AND_BUILD_TIME set in the App Spec, so I’m pretty confused as to why my variable isn’t available at build time.
Any help is appreciated. Thank you in advance!
d1dd3d9538cc4d06b53e6d1d338d3f
50ff4e4b3c6c4999a12403b1ecda95
a6309a057c3f4cb38fb2e7feb67236
72e571841e7f4a6881090a2f3e93c0
57a72a98162f46a5a5cd04d9b
Thomas Brocken
11575c6d695643cdb40ad47d0f1aea
tez.saad
keneucker
keneucker
max johnson
max johnson