-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathDockerfile
37 lines (27 loc) · 1.3 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
FROM python:3.11-slim
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
# Setup dependencies for pyodbc
RUN \
export ACCEPT_EULA='Y' && \
# Install build dependencies
apt-get update && \
apt-get install -y curl gcc libpq-dev build-essential unixodbc-dev g++ apt-transport-https
RUN \
# Install pyodbc db drivers for MSSQL and PostgreSQL
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /usr/share/keyrings/microsoft-prod.gpg && \
curl -sSL https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
RUN \
# install the rest of them
apt-get update && \
ACCEPT_EULA=Y apt-get install -y msodbcsql18 odbc-postgresql && \
# Update odbcinst.ini to make sure full path to driver is listed, and set CommLog to 0. i.e disables any communication logs to be written to files
sed 's/Driver=psql/Driver=\/usr\/lib\/x86_64-linux-gnu\/odbc\/psql/;s/CommLog=1/CommLog=0/' /etc/odbcinst.ini > /tmp/temp.ini && \
mv -f /tmp/temp.ini /etc/odbcinst.ini
ENV VIRTUAL_ENV=/usr/local
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
RUN /install.sh && rm /install.sh
RUN $HOME/.local/bin/uv pip install --system --no-cache -r requirements.txt
COPY . /app
RUN pip3 install -e . && pip3 install pyodbc
ENTRYPOINT ["ingestr"]