-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (37 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
49 lines (37 loc) · 1.27 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
# Multi-stage Docker build for Ask-Intercom web app with follow-up questions feature
FROM node:18-alpine as frontend-builder
# Build frontend
WORKDIR /app/frontend
COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile
COPY frontend/ .
RUN pnpm run build
# Python backend stage
FROM python:3.11-slim as backend
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN pip install poetry
# Set working directory
WORKDIR /app
# Copy Python dependencies
COPY pyproject.toml poetry.lock ./
RUN poetry config virtualenvs.create false \
&& poetry install --only main --no-root
# Copy application code
COPY src/ ./src/
# Copy built frontend
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Copy startup script
COPY start.sh ./start.sh
RUN chmod +x ./start.sh
# Create non-root user and app directory with proper permissions
RUN useradd --create-home --shell /bin/bash app && \
mkdir -p /app/.ask-intercom-analytics/logs /app/.ask-intercom-analytics/sessions && \
chown -R app:app /app
USER app
# Railway will auto-detect port from CMD
CMD ["python", "-m", "uvicorn", "src.web.main:app", "--host", "0.0.0.0", "--port", "8000"]