-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (31 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
42 lines (31 loc) · 1.03 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
# The build image
FROM python:3.12-slim-bookworm AS builder
# Install and configure poetry
RUN pip install poetry
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
# Copy files needed to build
COPY pyproject.toml poetry.lock ./
RUN touch README.md
# Install all dependencies
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
# The runtime image
FROM python:3.12-slim-bookworm AS runtime
# libmagic is needed for python-magic package
RUN apt-get update && apt-get install -y --no-install-recommends \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
# Set variables to point to the built virtualenv
ENV VIRTUAL_ENV=/app/.venv PATH="/app/.venv/bin:$PATH"
# Copy python virtualenv from the build step
WORKDIR /app
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
# Copy needed files
COPY src ./openrelik
# Copy over DuckDB extension
COPY extras ./openrelik
# Set workdir for Uvicorn to function
WORKDIR /app/openrelik