forked from benarch/Azure-IPAM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
52 lines (37 loc) · 1.42 KB
/
Copy pathDockerfile.api
File metadata and controls
52 lines (37 loc) · 1.42 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
# =============================================================================
# Azure IPAM API - Production Dockerfile
# Multi-stage build for Azure Functions Node.js runtime
# =============================================================================
# Build from repo root: docker build -f deploy/docker/Dockerfile.api -t azure-ipam-api .
# =============================================================================
# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY api/package*.json ./
# Install all dependencies (including devDependencies for build)
RUN npm ci
# Copy source code
COPY api/ .
# Build TypeScript
RUN npm run build
# Stage 2: Production
FROM mcr.microsoft.com/azure-functions/node:4-node20-slim AS production
WORKDIR /home/site/wwwroot
# Copy package files from builder
COPY --from=builder /app/package*.json ./
# Install production dependencies only
RUN npm ci --only=production
# Copy built files from builder
COPY --from=builder /app/dist ./dist
# Copy Azure Functions configuration files
COPY --from=builder /app/host.json ./
# Environment variables
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
ENV AzureFunctionsJobHost__Logging__Console__IsEnabled=true
ENV FUNCTIONS_WORKER_RUNTIME=node
# Expose Functions port
EXPOSE 7071
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:7071/api/health || exit 1