-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
87 lines (68 loc) · 2.25 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
FROM python:3.11.3
# Switching to root to install the required packages
USER root
# Update OS and install packages
RUN apt-get update --yes && \
apt-get dist-upgrade --yes && \
apt-get install --yes \
build-essential \
ca-certificates \
chromium \
cmake \
curl \
default-libmysqlclient-dev \
gcc \
git \
iputils-ping \
libboost-all-dev \
libffi-dev \
libldap2-dev \
libsasl2-dev \
libsqlite3-dev \
libssl-dev \
netcat \
ninja-build \
sqlite3 \
vim \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install NodeJS (needed for Apache Superset)
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y nodejs
# Create an application user
RUN useradd app_user --create-home
ARG APP_DIR=/app
RUN mkdir --parents ${APP_DIR} && \
chown app_user:app_user ${APP_DIR} && \
chown --recursive app_user:app_user /usr/local
USER app_user
WORKDIR ${APP_DIR}
# Setup a Python Virtual environment
ENV VIRTUAL_ENV=${APP_DIR}/venv
RUN python3 -m venv ${VIRTUAL_ENV} && \
echo ". ${VIRTUAL_ENV}/bin/activate" >> ~/.bashrc && \
. ~/.bashrc && \
pip install --upgrade setuptools pip
# Set the PATH so that the Python Virtual environment is referenced for subsequent RUN steps (hat tip: https://pythonspeed.com/articles/activate-virtualenv-dockerfile/)
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
# Copy the application code into the image
COPY --chown=app_user:app_user . ./adbc
WORKDIR ${APP_DIR}/adbc
# Install Apache Superset (using source)
RUN cp ./superset_config_files/setup.py ./apache-superset && \
cp ./superset_config_files/sql_lab.py ./apache-superset/superset/sql_lab.py && \
pip install --editable ./apache-superset
# Install Poetry package manager and then install the local ADBC SQLAlchemy driver project
ENV POETRY_VIRTUALENVS_CREATE="false"
RUN pip install poetry && \
poetry install
ENV FLASK_APP="superset.app:create_app()"
# Build javascript assets
WORKDIR ${APP_DIR}/adbc/apache-superset/superset-frontend
RUN npm ci && \
npm run build
# Initialize superset
WORKDIR ${APP_DIR}/adbc
EXPOSE 8088
ENTRYPOINT ["scripts/start_superset.sh"]