-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (35 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
45 lines (35 loc) · 1.31 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
# Base image: Python slim for a lightweight container
FROM python:3.11-slim
# Define environment variables with default values
# These can be overridden during container runtime
ENV BASE_URL="api.opencitations.net" \
LOG_DIR="/mnt/log_dir/oc_api" \
SPARQL_ENDPOINT_INDEX="http://qlever-service.default.svc.cluster.local:7011" \
SPARQL_ENDPOINT_META="http://virtuoso-service.default.svc.cluster.local:8890/sparql" \
SYNC_ENABLED="true"
# Ensure Python output is unbuffered
ENV PYTHONUNBUFFERED=1
# Install system dependencies + uv
RUN apt-get update && \
apt-get install -y \
git \
python3-dev \
build-essential \
curl && \
curl -LsSf https://astral.sh/uv/install.sh | sh && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Make uv available in PATH
ENV PATH="/root/.local/bin:$PATH"
# Set the working directory for our application
WORKDIR /website
# Copy dependency files first for better Docker layer caching
COPY pyproject.toml uv.lock README.md ./
# Install dependencies (frozen = use exact lockfile versions)
RUN uv sync --frozen --no-dev --no-install-project
# Copy application code
COPY . .
# Expose the port that our service will listen on
EXPOSE 8080
# Start the application with gunicorn via uv
CMD ["uv", "run", "gunicorn", "-c", "gunicorn.conf.py", "api_oc:application"]