-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 998 Bytes
/
Dockerfile
File metadata and controls
45 lines (32 loc) · 998 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
35
36
37
38
39
40
41
42
43
44
45
# Build stage
FROM node:22-alpine AS builder
# Add metadata labels
LABEL maintainer="Hamlet Jiang Su"
LABEL description="Thunder server for handling notifications and related services"
LABEL version="0.1.0"
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY tsconfig.json ./
# Install all dependencies (including dev dependencies for building)
# Clear npm cache to avoid potential cache conflicts in CI environments
RUN npm cache clean --force && npm ci
# Copy source code
COPY src/ ./src/
# Build TypeScript to JavaScript
RUN npm run build || npx tsc
# Production stage
FROM node:22-alpine AS production
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install only production dependencies
RUN npm cache clean --force && npm ci --omit=dev
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
# Expose the port the app runs on
EXPOSE 2831
# Start the server
CMD ["node", "dist/index.js"]