-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (43 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
62 lines (43 loc) · 1.22 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Multi-stage build
FROM node:20-alpine AS backend-builder
WORKDIR /app/backend
# Copy backend package files
COPY backend/package*.json ./
RUN npm ci
# Copy backend source
COPY backend/ ./
# Build backend
RUN npm run build
# Frontend builder stage
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy frontend package files
COPY frontend/package*.json ./
RUN npm ci
# Copy frontend source
COPY frontend/ ./
# Build frontend
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Install production dependencies for backend
COPY backend/package*.json ./
RUN npm ci --production
# Copy built backend
COPY --from=backend-builder /app/backend/dist ./dist
# Copy built frontend
COPY --from=frontend-builder /app/frontend/dist ./public
# Create data directory
RUN mkdir -p /app/data /app/logs
# Set environment variables
ENV NODE_ENV=production
ENV PORT=5069
ENV DATABASE_PATH=/app/data/librarydownloadarr.db
# Expose port
EXPOSE 5069
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
CMD node -e "require('http').get('http://localhost:5069/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
# Start the application
CMD ["node", "dist/index.js"]