forked from abeuscher/vue-ai-example
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.secure
More file actions
43 lines (31 loc) · 971 Bytes
/
Copy pathDockerfile.secure
File metadata and controls
43 lines (31 loc) · 971 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
# Secure Dockerfile for MAIA Vue AI Example (Local Development)
FROM node:20-alpine
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs
RUN adduser -S maia -u 1001
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install all dependencies (including dev dependencies for build)
RUN npm ci && npm cache clean --force
# Copy source code
COPY . .
# Build the frontend
RUN npm run build
# Remove dev dependencies to reduce image size
RUN npm prune --production
# Change ownership to non-root user
RUN chown -R maia:nodejs /app
USER maia
# Expose port
EXPOSE 3001
# Set environment
ENV NODE_ENV=development
ENV PORT=3001
ENV LOCAL_TESTING=true
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3001/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"
# Start the secure server
CMD ["node", "server-secure.js"]