-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (43 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
54 lines (43 loc) · 1.38 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
# Stage 1: Build Frontend (Nuxt SSR)
FROM node:22-alpine AS frontend-build
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ .
# Build for server mode
RUN npm run build
# Stage 2: Build Backend Dependencies
FROM python:3.11-slim AS backend-build
WORKDIR /app
COPY backend/requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# Stage 3: Final Runtime Image
FROM python:3.11-slim
WORKDIR /app
# Install Node.js (for Nuxt server) and system dependencies
RUN apt-get update && apt-get install -y \
curl \
gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Copy python dependencies
COPY --from=backend-build /install /usr/local
# Copy backend code
COPY backend/ ./backend
# Copy frontend server output
COPY --from=frontend-build /app/frontend/.output ./frontend/.output
# Set working directory to backend for entrypoint
WORKDIR /app/backend
# Expose ports: 8000 (API), 3000 (Frontend)
EXPOSE 8000 3000
# Environment variables
ENV PYTHONUNBUFFERED=1
ENV DATABASE_DIR=/data
ENV STATIC_DIR=static
# Healthcheck (Checks API)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/ || exit 1
# Run command using entrypoint script
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]