-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.Dockerfile
More file actions
34 lines (24 loc) · 708 Bytes
/
.Dockerfile
File metadata and controls
34 lines (24 loc) · 708 Bytes
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
# 1) BUILD STAGE
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package.json & lockfile and install all deps
COPY package*.json ./
RUN npm ci
# Copy your source & build
COPY . .
RUN npm run build # assumes you have "build": "tsc" in package.json
# 2) PRODUCTION STAGE
FROM node:18-alpine
WORKDIR /app
# Only install production deps
COPY package*.json ./
RUN npm ci --only=production
# Copy built artifacts from builder
COPY --from=builder /app/dist ./dist
# Expose your app’s port (adjust if you use a different one)
EXPOSE 3000
# Default env vars (can be overridden at runtime)
ENV API_PATH=api/v1
ENV BASE_URL=http://localhost:3000
# Start the server
CMD ["node", "dist/app.js"]