-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (26 loc) · 831 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
# Use Node 21 as the base image for the builder stage
FROM node:21-alpine AS builder
LABEL maintainer="Rishi Ghan <[email protected]>"
# Set the working directory
WORKDIR /metadata-service
# Copy and install dependencies
COPY package.json package-lock.json ./
RUN npm ci --silent
# Copy source code and build the application
COPY . .
RUN npm run build
# Clean up development dependencies
RUN npm prune --production
# Final image using Node 21
FROM node:21-alpine
LABEL maintainer="Rishi Ghan <[email protected]>"
# Set the working directory
WORKDIR /metadata-service
# Copy the necessary files from the builder image
COPY --from=builder /metadata-service /metadata-service
# Set environment variables
ENV NODE_ENV=production
# Expose the application's port
EXPOSE 3080
# Start the application
CMD ["npm", "start"]