-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (39 loc) · 1.35 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
46
47
48
49
FROM python:3.9.16 AS python
ENV PYTHONUNBUFFERED=true
ENV PATH=$PATH:/root/.local/bin
WORKDIR /app
FROM python AS build
RUN apt-get update && \
apt-get install -y \
curl \
libpq-dev \
gcc \
unixodbc \
unixodbc-dev \
g++ \
python \
python3
# For pyodbc
ENV ACCEPT_EULA=Y
RUN apt-get install -y gnupg2
RUN curl -s -o microsoft.asc https://packages.microsoft.com/keys/microsoft.asc \
&& curl -s -o mssql-release.list https://packages.microsoft.com/config/debian/10/prod.list \
&& apt-get install -y g++
RUN apt-key add microsoft.asc && rm microsoft.asc && mv mssql-release.list /etc/apt/sources.list.d/mssql-release.list
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update -y
RUN apt-get install -y msodbcsql18
RUN apt-get install -y mssql-tools18
RUN echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
COPY . .
RUN pip install --upgrade pip
RUN poetry install --no-interaction --only main
FROM python as runtime
RUN useradd --create-home --shell /bin/bash app
USER app
COPY --from=build /app /app
ENV PATH="/app/.venv/bin:$PATH"
ENTRYPOINT ["/bin/bash", "start.sh"]