-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (32 loc) · 992 Bytes
/
Dockerfile
File metadata and controls
47 lines (32 loc) · 992 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
47
FROM node:20-alpine AS builder
# Install build dependencies
RUN apk add --no-cache python3 make g++
WORKDIR /app
# Copy package files
COPY package*.json ./
RUN npm ci
# Copy source files
COPY . .
# Build the application
RUN npm run build
# Copy public files to dist directory
RUN cp -r src/static dist/
# Production image
FROM node:20-alpine
WORKDIR /app
# Copy built files and package files
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./
# Note: data/ (SQL + YAML configs) is NOT bundled into the image.
# In production (ais-deploy), these are bind-mounted from the deploy repo.
# In local dev, run: docker compose -f docker-compose.yml up (uses local ./data)
# Install production dependencies only
RUN npm ci --only=production && \
npm cache clean --force
# Create non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 hono && \
chown -R hono:nodejs /app
USER hono
EXPOSE 3000
CMD ["npm", "start"]