-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
75 lines (56 loc) · 2.68 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
64
65
66
67
68
69
70
71
72
73
74
75
# Base run image
FROM node:lts-bullseye-slim AS base
## Install OS Packages
RUN apt update
RUN apt install --no-install-recommends curl jq gnupg ca-certificates python3-pip python3-venv supervisor default-libmysqlclient-dev -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && mkdir -p /etc/supervisor/conf.d
## Install mssql dependencies. Following: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=debian18-install%2Calpine17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline#18
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
### Download appropriate package for the OS version
### Debian 11
RUN curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt update
RUN ACCEPT_EULA=Y apt install -y msodbcsql18 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#####################################################################################################################################################
# Base build image
FROM base AS build
## Install OS and Postgres Dev Packages
RUN apt update
RUN apt install build-essential git make g++ libcurl4-openssl-dev python3-dev -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#####################################################################################################################################################
FROM build as sqlpal-stage
ENV LANG=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# copy the requirements file into the image
WORKDIR /server
RUN python3 -m venv ./venv
COPY server/requirements.txt ./
RUN . ./venv/bin/activate && pip install wheel && pip install --no-compile --disable-pip-version-check -r requirements.txt
# copy every content from the local file to the image
COPY server/run.py ./
COPY server/config.py ./
COPY server/app app
#####################################################################################################################################################
# Main stage
FROM base AS main-stage
## Copy from sqlpal-stage
WORKDIR /server
COPY --from=sqlpal-stage /server/requirements.txt ./
COPY --from=sqlpal-stage /server/app ./app
COPY --from=sqlpal-stage /server/run.py ./
COPY --from=sqlpal-stage /server/config.py ./
COPY --from=sqlpal-stage /server/venv ./venv
WORKDIR /
## Default ENVs that can be overwritten
ARG DB_USER=postgres
ENV DB_USER=$DB_USER
ARG DB_PASSWORD=test
ENV DB_PASSWORD=$DB_PASSWORD
ARG AUTOCOMPLETE_ENDPOINT=http://localhost:8088
ENV AUTOCOMPLETE_ENDPOINT=
## Ports
EXPOSE 8088
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]