-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile
39 lines (27 loc) · 938 Bytes
/
Dockerfile
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
# Use the official Node.js 18 image as a parent image
FROM node:18-alpine AS builder
# Set the working directory in the container to /app
WORKDIR /app
# Copy package.json and package-lock.json into the container
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci --ignore-scripts
# Copy the rest of the application code into the container
COPY src/ ./src/
COPY tsconfig.json ./
# Build the project
RUN npm run build
# Use a minimal node image as the base image for running
FROM node:18-alpine AS runner
WORKDIR /app
# Copy compiled code from the builder stage
COPY --from=builder /app/build ./build
COPY package.json package-lock.json ./
# Install only production dependencies
RUN npm ci --production --ignore-scripts
# Set environment variable for the Exa API key
ENV EXA_API_KEY=your-api-key-here
# Expose the port the app runs on
EXPOSE 3000
# Run the application
ENTRYPOINT ["node", "build/index.js"]