-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (31 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
43 lines (31 loc) · 1.03 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
# Use official Node.js runtime as base image
FROM node:18-alpine
# Set working directory in container
WORKDIR /app
# Create app user for security
RUN addgroup -g 1001 -S nodejs
RUN adduser -S teneo -u 1001
# Copy package files first for better layer caching
COPY marketplace/backend/package*.json ./
# Install build tools required for native modules (bcrypt, sqlite3)
RUN apk add --no-cache python3 make g++ curl
# Install dependencies
RUN npm ci --only=production && npm cache clean --force
# Copy application code
COPY marketplace/backend/ ./backend/
COPY marketplace/frontend/ ./frontend/
# Create necessary directories and set permissions
RUN mkdir -p /app/logs /app/uploads
RUN chown -R teneo:nodejs /app
# Expose port
EXPOSE 3001
# Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3001/api/health || exit 1
# Switch to non-root user
USER teneo
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3001
# Start the application
CMD ["node", "backend/server.js"]