-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.mock-api
More file actions
42 lines (30 loc) · 1.07 KB
/
Copy pathDockerfile.mock-api
File metadata and controls
42 lines (30 loc) · 1.07 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
# syntax=docker/dockerfile:1
# =============================================================================
# Dockerfile for Mock D-Tools API Server
# =============================================================================
# This is a lightweight image for the mock API server used in development
# and testing scenarios.
# =============================================================================
FROM node:20-alpine
# Install dumb-init for proper signal handling
RUN apk add --no-cache dumb-init wget
# Create non-root user
RUN addgroup -g 1001 -S mockapi && \
adduser -S mockapi -u 1001
# Set working directory
WORKDIR /app
# Copy mock API files
COPY mock-api/ ./mock-api/
# Set proper permissions
RUN chown -R mockapi:mockapi /app
# Switch to non-root user
USER mockapi
# Expose mock API port
EXPOSE 3456
# Health check
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost:3456/health || exit 1
# Use dumb-init for signal handling
ENTRYPOINT ["dumb-init", "--"]
# Run mock server
CMD ["node", "mock-api/server.js"]