2019-12-03 13:37:18 -05:00
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
2019-12-05 19:47:22 -05:00
|
|
|
######################################################################
|
|
|
|
# Node stage to deal with static asset construction
|
|
|
|
######################################################################
|
2022-10-06 11:08:10 -04:00
|
|
|
ARG PY_VER=3.8.13-slim
|
2022-09-19 05:30:17 -04:00
|
|
|
FROM node:16-slim AS superset-node
|
2021-02-15 14:45:29 -05:00
|
|
|
|
2020-03-13 12:25:54 -04:00
|
|
|
ARG NPM_BUILD_CMD="build"
|
|
|
|
ENV BUILD_CMD=${NPM_BUILD_CMD}
|
|
|
|
|
2019-12-05 19:47:22 -05:00
|
|
|
# NPM ci first, as to NOT invalidate previous steps except for when package.json changes
|
2020-02-09 20:53:56 -05:00
|
|
|
RUN mkdir -p /app/superset-frontend
|
2022-10-06 11:08:10 -04:00
|
|
|
|
2020-03-13 12:25:54 -04:00
|
|
|
COPY ./docker/frontend-mem-nag.sh /
|
2022-10-06 11:08:10 -04:00
|
|
|
RUN /frontend-mem-nag.sh
|
2019-12-03 13:37:18 -05:00
|
|
|
|
2022-10-06 11:08:10 -04:00
|
|
|
WORKDIR /app/superset-frontend/
|
2019-12-03 13:37:18 -05:00
|
|
|
|
2022-10-06 11:08:10 -04:00
|
|
|
COPY superset-frontend/package*.json ./
|
|
|
|
RUN npm ci
|
|
|
|
|
|
|
|
COPY ./superset-frontend .
|
|
|
|
|
|
|
|
# This seems to be the most expensive step
|
|
|
|
RUN npm run ${BUILD_CMD}
|
2019-12-05 19:47:22 -05:00
|
|
|
|
|
|
|
######################################################################
|
2019-12-03 13:37:18 -05:00
|
|
|
# Final lean image...
|
2019-12-05 19:47:22 -05:00
|
|
|
######################################################################
|
|
|
|
FROM python:${PY_VER} AS lean
|
2019-12-03 13:37:18 -05:00
|
|
|
|
|
|
|
ENV LANG=C.UTF-8 \
|
|
|
|
LC_ALL=C.UTF-8 \
|
|
|
|
FLASK_ENV=production \
|
|
|
|
FLASK_APP="superset.app:create_app()" \
|
|
|
|
PYTHONPATH="/app/pythonpath" \
|
|
|
|
SUPERSET_HOME="/app/superset_home" \
|
2021-03-12 11:13:11 -05:00
|
|
|
SUPERSET_PORT=8088
|
2019-12-03 13:37:18 -05:00
|
|
|
|
2021-05-29 07:35:11 -04:00
|
|
|
RUN mkdir -p ${PYTHONPATH} \
|
|
|
|
&& useradd --user-group -d ${SUPERSET_HOME} -m --no-log-init --shell /bin/bash superset \
|
2019-12-03 13:37:18 -05:00
|
|
|
&& apt-get update -y \
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
|
|
|
build-essential \
|
2023-01-10 11:10:46 -05:00
|
|
|
curl \
|
2019-12-03 13:37:18 -05:00
|
|
|
default-libmysqlclient-dev \
|
2022-10-06 11:08:10 -04:00
|
|
|
libsasl2-dev \
|
2021-03-16 18:42:53 -04:00
|
|
|
libsasl2-modules-gssapi-mit \
|
2019-12-03 13:37:18 -05:00
|
|
|
libpq-dev \
|
2021-11-17 05:23:54 -05:00
|
|
|
libecpg-dev \
|
2019-12-03 13:37:18 -05:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2022-10-06 11:08:10 -04:00
|
|
|
COPY ./requirements/*.txt /app/requirements/
|
|
|
|
COPY setup.py MANIFEST.in README.md /app/
|
|
|
|
|
|
|
|
# setup.py uses the version information in package.json
|
|
|
|
COPY superset-frontend/package.json /app/superset-frontend/
|
|
|
|
|
|
|
|
RUN cd /app \
|
|
|
|
&& mkdir -p superset/static \
|
|
|
|
&& touch superset/static/version_info.json \
|
|
|
|
&& pip install --no-cache -r requirements/local.txt
|
|
|
|
|
2020-02-12 10:48:24 -05:00
|
|
|
COPY --from=superset-node /app/superset/static/assets /app/superset/static/assets
|
2019-12-03 13:37:18 -05:00
|
|
|
|
2019-12-05 19:47:22 -05:00
|
|
|
## Lastly, let's install superset itself
|
|
|
|
COPY superset /app/superset
|
|
|
|
COPY setup.py MANIFEST.in README.md /app/
|
|
|
|
RUN cd /app \
|
|
|
|
&& chown -R superset:superset * \
|
2022-01-04 10:01:42 -05:00
|
|
|
&& pip install -e . \
|
|
|
|
&& flask fab babel-compile --target superset/translations
|
2019-12-05 19:47:22 -05:00
|
|
|
|
2021-12-08 13:43:28 -05:00
|
|
|
COPY ./docker/run-server.sh /usr/bin/
|
|
|
|
|
|
|
|
RUN chmod a+x /usr/bin/run-server.sh
|
2019-12-03 13:37:18 -05:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
USER superset
|
|
|
|
|
2020-11-24 15:39:10 -05:00
|
|
|
HEALTHCHECK CMD curl -f "http://localhost:$SUPERSET_PORT/health"
|
2019-12-03 13:37:18 -05:00
|
|
|
|
|
|
|
EXPOSE ${SUPERSET_PORT}
|
|
|
|
|
2021-12-08 13:43:28 -05:00
|
|
|
CMD /usr/bin/run-server.sh
|
2019-12-05 19:47:22 -05:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Dev image...
|
|
|
|
######################################################################
|
|
|
|
FROM lean AS dev
|
2022-11-01 18:02:37 -04:00
|
|
|
ARG GECKODRIVER_VERSION=v0.32.0
|
|
|
|
ARG FIREFOX_VERSION=106.0.3
|
2019-12-05 19:47:22 -05:00
|
|
|
|
2020-08-08 21:56:20 -04:00
|
|
|
COPY ./requirements/*.txt ./docker/requirements-*.txt/ /app/requirements/
|
2019-12-05 19:47:22 -05:00
|
|
|
|
|
|
|
USER root
|
2021-04-22 12:42:52 -04:00
|
|
|
|
|
|
|
RUN apt-get update -y \
|
2022-09-19 05:30:17 -04:00
|
|
|
&& apt-get install -y --no-install-recommends libnss3 libdbus-glib-1-2 libgtk-3-0 libx11-xcb1 wget
|
2021-04-22 12:42:52 -04:00
|
|
|
|
|
|
|
# Install GeckoDriver WebDriver
|
|
|
|
RUN wget https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -O /tmp/geckodriver.tar.gz && \
|
|
|
|
tar xvfz /tmp/geckodriver.tar.gz -C /tmp && \
|
|
|
|
mv /tmp/geckodriver /usr/local/bin/geckodriver && \
|
|
|
|
rm /tmp/geckodriver.tar.gz
|
|
|
|
|
|
|
|
# Install Firefox
|
|
|
|
RUN wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 -O /opt/firefox.tar.bz2 && \
|
|
|
|
tar xvf /opt/firefox.tar.bz2 -C /opt && \
|
|
|
|
ln -s /opt/firefox/firefox /usr/local/bin/firefox
|
|
|
|
|
2020-05-19 11:46:52 -04:00
|
|
|
# Cache everything for dev purposes...
|
2019-12-05 19:47:22 -05:00
|
|
|
RUN cd /app \
|
2020-08-08 21:56:20 -04:00
|
|
|
&& pip install --no-cache -r requirements/docker.txt \
|
|
|
|
&& pip install --no-cache -r requirements/requirements-local.txt || true
|
2020-02-09 20:53:56 -05:00
|
|
|
USER superset
|
2021-02-24 13:50:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# CI image...
|
|
|
|
######################################################################
|
|
|
|
FROM lean AS ci
|
|
|
|
|
|
|
|
COPY --chown=superset ./docker/docker-bootstrap.sh /app/docker/
|
|
|
|
COPY --chown=superset ./docker/docker-init.sh /app/docker/
|
|
|
|
COPY --chown=superset ./docker/docker-ci.sh /app/docker/
|
|
|
|
|
|
|
|
RUN chmod a+x /app/docker/*.sh
|
|
|
|
|
|
|
|
CMD /app/docker/docker-ci.sh
|