-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (51 loc) 路 1.87 KB
/
Copy pathDockerfile
File metadata and controls
70 lines (51 loc) 路 1.87 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
63
64
65
66
67
68
69
70
# syntax=docker.io/docker/dockerfile:1
###############################################################################
# Build #
###############################################################################
FROM debian:13-slim AS build
WORKDIR /app
# Install build dependencies
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
sudo curl ca-certificates libpq-dev build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install mise
# https://mise.jdx.dev/mise-cookbook/docker.html#docker-image-with-mise
ENV MISE_DATA_DIR="/mise"
ENV MISE_INSTALL_PATH="/usr/local/bin/mise"
ENV PATH="/mise/shims:$PATH"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl https://mise.run | sh
# Copy config
COPY mise.toml ./
COPY frontend/package.json frontend/pnpm-lock.yaml ./frontend/
# Install tools
RUN mise trust && mise install
# Install dependencies
RUN pnpm -C ./frontend install --frozen-lockfile --ignore-scripts
# Copy application
COPY . .
# Build OpenAPI client
RUN mise run build:openapi-client
# Build router
RUN mise run build:router
# Build frontend
RUN mise run build:frontend
###############################################################################
# Runtime Image #
###############################################################################
FROM python:3.12
WORKDIR /usr/src/kayman
EXPOSE 8000
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Copy dependencies
COPY backend/pyproject.toml backend/uv.lock ./
# Install dependencies
RUN uv sync --locked --no-dev
# Copy backend application
COPY backend/ ./
# Copy frontend application
COPY --from=build /app/frontend/dist ./static
# Run application
ENTRYPOINT ["uv", "run", "uvicorn", "kayman.main:app", "--host", "0.0.0.0", "--port", "8000"]