/
Dockerfile
58 lines (43 loc) · 1.37 KB
/
Dockerfile
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
# First, build the frontend
# Install dependencies only when needed
FROM node:16-alpine AS deps
RUN apk add --no-cache libc6-compat
COPY frontend/package.json frontend/yarn.lock ./
RUN yarn install --frozen-lockfile
# Rebuild the source code only when needed
FROM node:16-alpine AS builder
WORKDIR frontend/
COPY --from=deps /node_modules ./node_modules
COPY frontend/. .
# Disable telemetry
ENV NEXT_TELEMETRY_DISABLED 1
RUN yarn build
# Use an official Python base image
FROM python:3.11-slim as runner
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
# Add Poetry to PATH
ENV PATH="${PATH}:/root/.local/bin"
# Set working directory
WORKDIR /app
# Copy necessary files for the project
COPY pyproject.toml poetry.lock ./
# Install project dependencies
RUN poetry config virtualenvs.create false && \
poetry install --no-dev
# Copy your source files
COPY src/ ./src/
# Copy Alembic files
COPY alembic.ini ./
COPY alembic/ ./alembic/
# Copy frontend
COPY --from=builder /frontend/dist/ ./static/
# Expose the port your app will run on
EXPOSE 8080
# Start your application
CMD ["uvicorn", "src.main.main:app", "--host", "0.0.0.0", "--port", "8080", "--proxy-headers", "--forwarded-allow-ips", "*"]