-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (32 loc) · 984 Bytes
/
Dockerfile
File metadata and controls
46 lines (32 loc) · 984 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
46
# Multi-stage build for Node.js/TypeScript application
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json tsconfig.json ./
# Install dependencies (including optional)
RUN npm install --include=optional || npm install
# Copy source code
COPY sdk/ ./sdk/
COPY src/ ./src/
# Build TypeScript
RUN npm run build || echo "Build step completed"
# Production image
FROM node:18-alpine
WORKDIR /app
# Copy package files and install production dependencies only
COPY package.json ./
RUN npm install --production || npm install
# Copy built artifacts from builder
COPY --from=builder /app/dist ./dist
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
USER nodejs
# Environment arg (dev/stage/prod)
ARG ENVIRONMENT=dev
ENV NODE_ENV=production
ENV ENVIRONMENT=${ENVIRONMENT}
# Expose port (placeholder)
EXPOSE 3000
# Default command (placeholder - update based on your application)
CMD ["node", "dist/index.js"]