This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
95 lines (76 loc) · 2.81 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
##############
## Frontend ##
##############
FROM node:16 as frontend
WORKDIR /fidesops/clients/ops/admin-ui
COPY clients/ops/admin-ui/ .
RUN npm install
# Build the frontend static files
RUN npm run export
#############
## Backend ##
#############
FROM --platform=linux/amd64 python:3.9.14-slim-bullseye as backend
# Install auxiliary software
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
make \
vim \
curl \
g++ \
gnupg \
gcc \
python3-wheel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ARG SKIP_MSSQL_INSTALLATION
RUN echo "ENVIRONMENT VAR: SKIP_MSSQL_INSTALLATION $SKIP_MSSQL_INSTALLATION"
# SQL Server (MS SQL)
# https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15
RUN if [ "$SKIP_MSSQL_INSTALLATION" != "true" ] ; then apt-get install -y --no-install-recommends apt-transport-https && apt-get clean && rm -rf /var/lib/apt/lists/* ; fi
RUN if [ "$SKIP_MSSQL_INSTALLATION" != "true" ] ; then curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - ; fi
RUN if [ "$SKIP_MSSQL_INSTALLATION" != "true" ] ; then curl https://packages.microsoft.com/config/debian/11/prod.list | tee /etc/apt/sources.list.d/msprod.list ; fi
RUN if [ "$SKIP_MSSQL_INSTALLATION" != "true" ] ; then apt-get update ; fi
ENV ACCEPT_EULA=y DEBIAN_FRONTEND=noninteractive
RUN if [ "$SKIP_MSSQL_INSTALLATION" != "true" ] ; then apt-get -y --no-install-recommends install \
unixodbc-dev \
msodbcsql17 \
mssql-tools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* ; fi
#########################
## Python Dependencies ##
#########################
COPY mssql-requirements.txt .
RUN if [ "$SKIP_MSSQL_INSTALLATION" != "true" ] ; then pip --no-cache-dir install -r mssql-requirements.txt ; fi
COPY dev-requirements.txt .
RUN pip install -U pip --no-cache-dir install -r dev-requirements.txt
COPY requirements.txt .
RUN pip install -U pip --no-cache-dir install -r requirements.txt
###############################
## General Application Setup ##
###############################
COPY . /fidesops
WORKDIR /fidesops
# Immediately flush to stdout, globally
ENV PYTHONUNBUFFERED=TRUE
# Enable detection of running within Docker
ENV RUNNING_IN_DOCKER=true
COPY --from=frontend /fidesops/clients/ops/admin-ui/out/ /admin_ui
EXPOSE 8080
CMD [ "fidesops", "webserver" ]
#############################
## Development Application ##
#############################
FROM backend as dev
RUN pip install -e .
#############################
## Production Application ##
#############################
FROM backend as prod
# Install without a symlink
RUN python setup.py sdist
RUN pip install dist/fidesops-*.tar.gz
# Copy frontend build over
COPY --from=frontend /fidesops/clients/ops/admin-ui/out/ /admin_ui