-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (27 loc) · 912 Bytes
/
Dockerfile
File metadata and controls
39 lines (27 loc) · 912 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
# Stage 1: Build the Svelte frontend
FROM node:18-alpine AS builder
WORKDIR /app/frontend
# Copy package files and install dependencies
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install
# Copy the rest of the frontend source code
COPY frontend/ .
# Build the application
RUN npm run build
# Stage 2: Setup the Python backend and serve the frontend
FROM python:3.10-slim
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the built frontend from the builder stage
COPY --from=builder /app/frontend/dist /app/static/dist
# Copy the rest of the application files
COPY . .
# Create a non-root user to run the application
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
# Expose the port
EXPOSE 5000
# Command to run the application
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]