-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-api
37 lines (27 loc) · 963 Bytes
/
Dockerfile-api
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
# Use the official Python image from the Docker Hub
FROM python:3.11-slim AS base
# Set environment variables
ENV POETRY_VERSION=1.4.2 \
POETRY_VIRTUALENVS_CREATE=false \
PYTHONUNBUFFERED=1 \
STORAGE_LOCAL_CACHE_DIR="/app/scratch" \
STORAGE_BUCKET="simdata-bucket" \
STORAGE_ENDPOINT_URL="http://minio:9000" \
STORAGE_REGION="us-east-1" \
STORAGE_GCS_CREDENTIALS_FILE="/app/secret/gcs_credentials.json"
# Install Poetry
RUN pip install "poetry==$POETRY_VERSION"
# Set the working directory
WORKDIR /app
# Copy only the necessary files
COPY pyproject.toml poetry.lock /app/
# Install dependencies
RUN poetry install --no-root --only main
# Copy the rest of the application code
COPY . /app
# Declare the volume for local cache storage
VOLUME ["/app/scratch"]
# Expose the port FastAPI will run on
EXPOSE 8000
# Command to run the application
CMD ["uvicorn", "biosim_server.api.main:app", "--host", "0.0.0.0", "--port", "8000"]