forked from amancevice/docker-superset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
96 lines (81 loc) · 2.79 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
ARG NODE_VERSION=latest
ARG PYTHON_VERSION=latest
# --- Build assets with NodeJS
FROM node:${NODE_VERSION} AS build
# Superset version to build
ARG SUPERSET_VERSION=master
ENV SUPERSET_HOME=/var/lib/superset/
# Download source
WORKDIR ${SUPERSET_HOME}
RUN wget -O /tmp/superset.tar.gz https://github.com/apache/incubator-superset/archive/${SUPERSET_VERSION}.tar.gz && \
tar xzf /tmp/superset.tar.gz -C ${SUPERSET_HOME} --strip-components=1
# Build assets
WORKDIR ${SUPERSET_HOME}/superset/assets
RUN npm install && \
npm run build
# --- Build dist package with Python 3
FROM python:${PYTHON_VERSION} AS dist
# Copy prebuilt workspace into stage
ENV SUPERSET_HOME=/var/lib/superset/
WORKDIR ${SUPERSET_HOME}
COPY --from=build ${SUPERSET_HOME} .
COPY requirements-db.txt .
# Create package to install
RUN python setup.py sdist && \
tar czfv /tmp/superset.tar.gz requirements.txt requirements-db.txt dist
# --- Install dist package and finalize app
FROM python:${PYTHON_VERSION} AS final
# 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=3 \
GUNICORN_THREADS=4 \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PYTHONPATH=/etc/superset:/home/superset:$PYTHONPATH \
SUPERSET_REPO=apache/incubator-superset \
SUPERSET_VERSION=${SUPERSET_VERSION} \
SUPERSET_HOME=/var/lib/superset
ENV GUNICORN_CMD_ARGS="--workers ${GUNICORN_WORKERS} --threads ${GUNICORN_THREADS} --timeout ${GUNICORN_TIMEOUT} --bind ${GUNICORN_BIND} --limit-request-line ${GUNICORN_LIMIT_REQUEST_LINE} --limit-request-field_size ${GUNICORN_LIMIT_REQUEST_FIELD_SIZE}"
# Create superset user & install dependencies
WORKDIR /tmp/superset
COPY --from=dist /tmp/superset.tar.gz .
RUN groupadd supergroup && \
useradd -U -m -G supergroup superset && \
mkdir -p /etc/superset && \
mkdir -p ${SUPERSET_HOME} && \
chown -R superset:superset /etc/superset && \
chown -R superset:superset ${SUPERSET_HOME} && \
apt-get update && \
apt-get install -y \
git \
build-essential \
curl \
default-libmysqlclient-dev \
freetds-bin \
freetds-dev \
libaio1 \
libffi-dev \
libldap2-dev \
libpq-dev \
libsasl2-2 \
libsasl2-dev \
libsasl2-modules-gssapi-mit \
libssl1.0 && \
apt-get clean && \
tar xzf superset.tar.gz && \
pip install dist/*.tar.gz -r requirements.txt -r requirements-db.txt && \
rm -rf ./*
# Configure Filesystem
COPY bin /usr/local/bin
WORKDIR /home/superset
VOLUME /etc/superset \
/home/superset \
/var/lib/superset
# Finalize application
EXPOSE 8088
HEALTHCHECK CMD ["curl", "-f", "https://localhost:8088/health"]
CMD ["gunicorn", "superset:app"]
USER superset