forked from danielmeppiel/agentic-platform-engineering
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (55 loc) · 1.4 KB
/
Copy pathDockerfile
File metadata and controls
72 lines (55 loc) · 1.4 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Build stage
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:22-alpine
# Install dependencies for Azure CLI
RUN apk --no-cache add \
bash \
ca-certificates \
curl \
gcc \
libc-dev \
libffi-dev \
make \
musl-dev \
openssl-dev \
python3 \
python3-dev \
py3-pip \
jq
# Install Azure CLI in a virtual environment
RUN mkdir -p /opt/az && \
python3 -m venv /opt/az/venv && \
/opt/az/venv/bin/pip install --upgrade pip && \
/opt/az/venv/bin/pip install azure-cli && \
ln -s /opt/az/venv/bin/az /usr/local/bin/az
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm ci --production
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/config ./config
# Set environment variables
ENV NODE_ENV=production
ENV PATH=$PATH:/usr/local/bin:/opt/az/venv/bin
# Create non-root user and ensure Azure CLI is accessible
RUN addgroup -S appgroup && adduser -S appuser -G appgroup && \
mkdir -p /home/appuser/.azure && \
chown -R appuser:appgroup /home/appuser/.azure && \
chmod -R 755 /opt/az
USER appuser
# Expose port
EXPOSE 3000
# Start the application
CMD ["npm", "start"]