Spaces:
Running
Running
File size: 714 Bytes
1faf799 |
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 |
# Stage 1: Build the frontend, and install server dependencies
FROM node:22 AS builder
WORKDIR /app
# Copy all files from the current directory
COPY . ./
RUN echo "API_KEY=PLACEHOLDER" > ./.env
RUN echo "GEMINI_API_KEY=PLACEHOLDER" >> ./.env
# Install server dependencies
WORKDIR /app/server
RUN npm install
# Install dependencies and build the frontend
WORKDIR /app
RUN mkdir dist
RUN bash -c 'if [ -f package.json ]; then npm install && npm run build; fi'
# Stage 2: Build the final server image
FROM node:22
WORKDIR /app
#Copy server files
COPY --from=builder /app/server .
# Copy built frontend assets from the builder stage
COPY --from=builder /app/dist ./dist
EXPOSE 3000
CMD ["node", "server.js"]
|