-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (36 loc) · 920 Bytes
/
Dockerfile
File metadata and controls
51 lines (36 loc) · 920 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
48
49
50
51
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the Angular application
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm ci --only=production
# Copy built application from builder stage
COPY --from=builder /app/dist/citizenos-fe/browser ./dist/citizenos-fe/browser
COPY --from=builder /app/index.js ./
COPY --from=builder /app/config ./config
# Create non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
RUN chown -R appuser:appgroup /app
# Switch to non-root user
USER appuser
# Expose ports
EXPOSE 3000
EXPOSE 3001
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3000
ENV PORT_SSL=3001
# Start the application
CMD ["node", "index.js"]