-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (34 loc) · 1.31 KB
/
Dockerfile
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
# Use the official Python image as a parent image
FROM python:3.9-slim
# Set environment variables to ensure the output is logged directly
ENV PYTHONUNBUFFERED=1
# Set the working directory in the container
WORKDIR /app
# Install system dependencies and the ODBC Driver for SQL Server
RUN apt-get update && apt-get install -y \
curl \
apt-transport-https \
gnupg \
gcc \
unixodbc-dev \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY requirements.txt .
# Install the dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container
COPY . .
# Copy the .env file into the container
COPY .env .env
# Copy the entrypoint script into the container
COPY entrypoint.sh /app/entrypoint.sh
# Make the entrypoint script executable
RUN chmod +x /app/entrypoint.sh
# Set the entrypoint to the entrypoint script
ENTRYPOINT ["/app/entrypoint.sh"]
# Default command to run Uvicorn
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]