forked from 1v-lone/open-backend
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (30 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
39 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM node:22-alpine
WORKDIR /app
# Install curl (for Coolify healthchecks) and openssl (required by Prisma on Alpine)
RUN apk add --no-cache curl openssl
# 1. Copy dependency files first to maximize Docker layer caching
COPY package*.json ./
RUN npm install
# 2. Copy All folders for future proofing incase of custom setups later on
COPY . .
# 3. Define build arguments (ARGs).
# These will be available for `prisma generate` and `npm run build`,
ARG DATABASE_URL=postgresql://CHANGETHISDONOTFOLLOWTHIS:5432/placeholder_db
ARG META_NAME
ARG META_DESCRIPTION
ARG CRYPTO_SECRET
ARG TMDB_API_KEY
ARG CAPTCHA=false
ARG CAPTCHA_CLIENT_KEY
ARG TRAKT_CLIENT_ID
ARG TRAKT_SECRET_ID
# 4. Generate Prisma client using the build-only placeholder URL
RUN DATABASE_URL=${DATABASE_URL} npx prisma generate
# 5. Build the application (it will use the ARGs above during compilation)
RUN npm run build
# 6. Set ONLY the essential, safe runtime variable.
ENV NODE_ENV=production
EXPOSE 3000
# Run migrations and start the server
# Users MUST provide the real variables via Docker Run / Compose
CMD ["sh", "-c", "npx prisma migrate deploy && node .output/server/index.mjs"]