-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
48 lines (36 loc) · 1.03 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
40
41
42
43
44
45
46
47
48
FROM node:20-alpine
# Install Poppler utilities (including pdftocairo)
RUN apk add --no-cache poppler-utils python3 make g++ build-base
# Declare build arguments for environment variables needed at build time
ARG OPENAI_API_KEY
ARG UPSTASH_REDIS_REST_URL
ARG UPSTASH_REDIS_REST_TOKEN
ARG DATABASE_URL
ARG LOG_LEVEL
ARG NODE_ENV
ARG DEBUG
# Set environment variables from build arguments
ENV OPENAI_API_KEY=$OPENAI_API_KEY
ENV UPSTASH_REDIS_REST_URL=$UPSTASH_REDIS_REST_URL
ENV UPSTASH_REDIS_REST_TOKEN=$UPSTASH_REDIS_REST_TOKEN
ENV DATABASE_URL=$DATABASE_URL
ENV LOG_LEVEL=$LOG_LEVEL
ENV NODE_ENV=$NODE_ENV
ENV DEBUG=$DEBUG
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install all dependencies (including dev deps needed for build)
RUN npm ci
# Copy source code
COPY . .
# Generate Prisma client
RUN npx prisma generate
# Build the application (ensure we have all dependencies)
RUN npm run build
# Remove dev dependencies after build
RUN npm prune --production
# Expose port
EXPOSE 3000
# Start the application
CMD ["npm", "start"]