-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (38 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
54 lines (38 loc) · 1.44 KB
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
47
48
49
50
51
52
53
54
# Intent Engine API with Swagger Documentation
# ---- Builder Stage ----
# This stage installs production dependencies
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev --ignore-scripts && \
npm cache clean --force
# ---- Final Stage ----
# This stage creates the final image
FROM node:18-alpine
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S intentengine -u 1001
WORKDIR /app
# Copy package files first for proper dependency resolution
COPY --chown=intentengine:nodejs package*.json ./
# Copy dependencies from builder stage
COPY --from=builder --chown=intentengine:nodejs /app/node_modules ./node_modules
# Copy application code
COPY --chown=intentengine:nodejs . .
# Switch to non-root user
USER intentengine
# Expose the port
EXPOSE 3002
# Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD [ "node", "-e", "require(\"http\").get(\"http://localhost:3002/health\", (res) => process.exit(res.statusCode == 200 ? 0 : 1)).on('error', () => process.exit(1))" ]
# Environment variables
ENV NODE_ENV=production
ENV PORT=3002
# Start the application
CMD ["npm", "start"]
# Labels for better container management
LABEL maintainer="Zap Pilot"
LABEL description="Intent Engine API with integrated Swagger documentation"
LABEL version="1.0.0"
LABEL org.opencontainers.image.source="https://github.com/all-weather-protocol/intent-engine"