forked from pipeops-dev/pipeops-adonisJs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (24 loc) · 732 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
40
# Stage 1: Build the project
FROM node:18-alpine AS builder
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
# Install project dependencies
RUN npm ci
# Copy the rest of the application code
COPY . .
# Build the project
RUN npm run build
# Stage 2: Create a minimal production image
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY package.json package-lock.json ./
# Install only production dependencies
RUN npm ci --omit=dev
# Copy only the build artifacts from the previous stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/src ./src
EXPOSE 3000
CMD ["npm", "run", "start"]