mirror of
https://github.com/p-stream/backend.git
synced 2026-03-11 09:45:34 +00:00
Some checks failed
Build and Publish Docker image to GHCR / build-and-push (push) Has been cancelled
39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
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"]
|