Spaces:
Sleeping
Sleeping
File size: 1,032 Bytes
0bcc252 56fce6e 0bcc252 |
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 |
# ---- BUILD STAGE ----
FROM node:20-slim AS builder
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install --ignore-scripts
# Copy application code
COPY . .
# Build the application
RUN npm run build --ignore-scripts
# ---- PRODUCTION STAGE ----
FROM node:20-slim AS production
# Set working directory
WORKDIR /app
RUN chmod -R 777 /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install production dependencies only
RUN npm install --production --ignore-scripts
# Copy config.json and built files from builder
COPY --from=builder /app/config.json ./
COPY --from=builder /app/dist ./dist
# Set environment variables (Recommended to set at runtime, avoid hardcoding)
ENV GEMINI_API_KEY=${GEMINI_API_KEY}
ENV OPENAI_API_KEY=${OPENAI_API_KEY}
ENV JINA_API_KEY=${JINA_API_KEY}
ENV BRAVE_API_KEY=${BRAVE_API_KEY}
# Expose the port the app runs on
EXPOSE 3000
# Set startup command
CMD ["node", "./dist/server.js"]
|