Skip to content

Commit 993e37b

Browse files
Implementing docker file
1 parent 04434ff commit 993e37b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Use Node.js with alpine for a lightweight environment
2+
FROM node:lts-alpine3.20 AS base
3+
# Install system dependencies required for the application
4+
RUN apk update && apk add --no-cache \
5+
python3 \
6+
make \
7+
g++ \
8+
ca-certificates
9+
# Set working directory
10+
WORKDIR /app
11+
# Copy `package.json` and `package-lock.json` to the container
12+
COPY package*.json ./
13+
# Copy the rest of the application source code
14+
COPY . .
15+
# Expose API port
16+
EXPOSE 4000
17+
18+
FROM base AS prod
19+
# Install only production dependencies
20+
RUN npm ci --omit=dev
21+
# Build the TypeScript application
22+
RUN npm run build
23+
# Start the Node.js application in prod mode
24+
CMD ["npm", "start"]
25+
26+
FROM base AS dev
27+
# Install dependencies (including dev)
28+
RUN npm ci
29+
# Start the Node.js application in dev mode
30+
CMD ["npm", "dev"]

0 commit comments

Comments
 (0)