-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (25 loc) · 930 Bytes
/
Dockerfile
File metadata and controls
34 lines (25 loc) · 930 Bytes
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
# Use Python 3.11 as base image
FROM python:3.11-slim
LABEL org.opencontainers.image.source=https://github.com/sdsc-ordes/text-contextifyer
# Set working directory
WORKDIR /app
# Install poetry with latest stable version
RUN pip install poetry==2.2.1
# Copy dependency files for better layer caching
COPY pyproject.toml poetry.lock* ./
# Configure poetry
RUN poetry config virtualenvs.create false && \
poetry config installer.max-workers 4
# Install production dependencies only
RUN poetry install --without dev --no-interaction --no-ansi --no-root
# Copy source code and install the project
COPY src/ src/
RUN poetry install --only-root --no-interaction --no-ansi
# Expose port for FastAPI
# Set environment variables
ENV PYTHONPATH=/app/src
ENV PYTHONUNBUFFERED=1
ENV PORT=8001
EXPOSE ${PORT}
# Run FastAPI server
CMD ["sh", "-c", "poetry run uvicorn text_contextifyer.api.main:app --host 0.0.0.0 --port ${PORT}"]