forked from opendatadiscovery/odd-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (48 loc) · 1.82 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM python:3.9.12-slim-buster as base
ENV POETRY_HOME=/etc/poetry \
POETRY_VERSION=1.3.1
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
FROM base AS build
RUN apt-get update && \
apt-get install -y -q build-essential \
python3-dev \
libpq-dev \
curl \
librdkafka-dev \
unixodbc \
unixodbc-dev \
openssl
# For pyodbc
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 update -y \
&& apt-get install -y g++ unixodbc-dev
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=${POETRY_HOME} python3 -
RUN poetry config virtualenvs.create false
RUN poetry config experimental.new-installer false
COPY poetry.lock pyproject.toml ./
RUN poetry lock --no-update
RUN poetry install --no-interaction --no-ansi --no-dev -vvv
FROM base as runtime
# For pyodbc
COPY --from=build microsoft.asc microsoft.asc
COPY --from=build mssql-release.list mssql-release.list
ENV ACCEPT_EULA=Y
RUN apt-get update -y && apt-get install -y gnupg2 \
&& apt-key add microsoft.asc && rm microsoft.asc \
&& mv mssql-release.list /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update -y \
&& apt-get install -y g++ unixodbc-dev \
&& apt-get install -y unixodbc-bin \
&& apt-get install -y msodbcsql17 libgssapi-krb5-2 libpq-dev
RUN useradd --create-home --shell /bin/bash app
USER app
# non-interactive env vars https://bugs.launchpad.net/ubuntu/+source/ansible/+bug/1833013
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true
ENV UCF_FORCE_CONFOLD=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY . ./
COPY --from=build /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
ENTRYPOINT ["/bin/bash", "start.sh"]