/
Dockerfile
114 lines (99 loc) · 3.61 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
FROM python:3.8.13
# Superset version
ARG SUPERSET_VERSION=1.5.2
# Superset-patchup (Ketchup) version
ARG SUPERSET_PATCHUP_VERSION=v0.5.1
# Default Superset files dir
ARG APP_DIR=/usr/local/lib/python3.8/site-packages/superset
# Configure environment
ENV GUNICORN_BIND=0.0.0.0:8088 \
GUNICORN_LIMIT_REQUEST_FIELD_SIZE=0 \
GUNICORN_LIMIT_REQUEST_LINE=0 \
GUNICORN_TIMEOUT=60 \
GUNICORN_WORKERS=2 \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PYTHONPATH=/etc/superset:/home/superset:$PYTHONPATH \
SUPERSET_REPO=apache/superset \
SUPERSET_VERSION=${SUPERSET_VERSION} \
SUPERSET_PATCHUP_VERSION=${SUPERSET_PATCHUP_VERSION} \
SUPERSET_PATCHUP_REPO=https://github.com/OpenLMIS/superset-patchup.git@${SUPERSET_PATCHUP_VERSION} \
SUPERSET_HOME=/var/lib/superset \
APP_DIR=${APP_DIR} \
WORKER_CLASS=gevent
ENV GUNICORN_CMD_ARGS="--workers ${GUNICORN_WORKERS} -k ${WORKER_CLASS} --timeout ${GUNICORN_TIMEOUT} --bind ${GUNICORN_BIND} --limit-request-line ${GUNICORN_LIMIT_REQUEST_LINE} --limit-request-field_size ${GUNICORN_LIMIT_REQUEST_FIELD_SIZE}"
COPY requirements.txt requirements.txt
# Create superset user & install dependencies
RUN useradd -U -m superset && \
mkdir /etc/superset && \
mkdir ${SUPERSET_HOME} && \
chown -R superset:superset /etc/superset && \
chown -R superset:superset ${SUPERSET_HOME} && \
apt-get update && \
apt-get install -y \
rsync \
build-essential \
curl \
default-libmysqlclient-dev \
freetds-bin \
freetds-dev \
postgresql-client \
libssl-dev \
libffi-dev \
python-dev \
libsasl2-dev \
libldap2-dev && \
apt-get clean && \
rm -r /var/lib/apt/lists/* && \
pip install --upgrade setuptools pip && \
pip install --no-cache-dir \
gunicorn==20.1.0 \
gevent==22.10.2 \
git+${SUPERSET_PATCHUP_REPO} \
apache-superset==${SUPERSET_VERSION} \
apache-superset[cors]==${SUPERSET_VERSION} \
flask-mail==0.9.1 \
flask-oauth==0.12 \
flask_oauthlib==0.9.5 && \
# MarkupSafe, fix missing 'soft_unicode' from 'markupsafe'
# fix cryptography, flask, werkzeug to last known working versions
pip install -I --no-cache-dir \
MarkupSafe==2.0.1 \
cryptography==38.0.2 \
flask==1.1.4 \
werkzeug==1.0.1 \
psycopg2-binary==2.9.1
# Configure Filesystem
RUN find ${APP_DIR} \! -type l -print0 | xargs -0 chown superset:superset
COPY superset /usr/local/bin
VOLUME /etc/superset \
/var/lib/superset
WORKDIR $APP_DIR
# Node & npm
ENV NVM_DIR=/usr/local/nvm
ENV NODE_VERSION=v16.16.0
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
RUN . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH=$NVM_DIR/versions/node/$NODE_VERSION/lib/node_modules
ENV PATH=$NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH
RUN node -v
RUN npm -v
# Installing dependecies via npm
RUN npm install -g po2json
# Fetching dependecies and first build
RUN wget -P /tmp https://github.com/apache/superset/archive/${SUPERSET_VERSION}.zip \
&& unzip /tmp/${SUPERSET_VERSION}.zip -d /tmp \
&& rsync -a \
--remove-source-files \
--chown=superset:superset \
/tmp/superset-${SUPERSET_VERSION}/superset-frontend $APP_DIR \
&& rm -r /tmp/${SUPERSET_VERSION}.zip
USER superset:superset
RUN cd $APP_DIR/superset-frontend && npm ci
# Deploy application
EXPOSE 8088
HEALTHCHECK CMD ["curl", "-f", "http://localhost:8088/health"]
CMD ["gunicorn", "superset:app"]