mirror of
https://github.com/apache/superset.git
synced 2026-08-12 11:11:01 +00:00
feat(docker): Use docker buildx and Add ARM builds for dockerize and websocket (#25377)
This commit is contained in:
+30
-24
@@ -22,16 +22,14 @@ ARG PY_VER=3.9-slim-bookworm
|
||||
|
||||
# if BUILDPLATFORM is null, set it to 'amd64' (or leave as is otherwise).
|
||||
ARG BUILDPLATFORM=${BUILDPLATFORM:-amd64}
|
||||
FROM --platform=${BUILDPLATFORM} node:16-slim AS superset-node
|
||||
FROM --platform=${BUILDPLATFORM} node:16-bookworm-slim AS superset-node
|
||||
|
||||
ARG NPM_BUILD_CMD="build"
|
||||
|
||||
RUN apt-get update -q \
|
||||
&& apt-get install -yq --no-install-recommends \
|
||||
python3 \
|
||||
make \
|
||||
gcc \
|
||||
g++
|
||||
RUN apt-get update -qq \
|
||||
&& apt-get install -yqq --no-install-recommends \
|
||||
build-essential \
|
||||
python3
|
||||
|
||||
ENV BUILD_CMD=${NPM_BUILD_CMD} \
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
@@ -41,8 +39,9 @@ WORKDIR /app/superset-frontend
|
||||
RUN --mount=type=bind,target=/frontend-mem-nag.sh,src=./docker/frontend-mem-nag.sh \
|
||||
/frontend-mem-nag.sh
|
||||
|
||||
COPY superset-frontend/package*.json ./
|
||||
RUN npm ci
|
||||
RUN --mount=type=bind,target=./package.json,src=./superset-frontend/package.json \
|
||||
--mount=type=bind,target=./package-lock.json,src=./superset-frontend/package-lock.json \
|
||||
npm ci
|
||||
|
||||
COPY ./superset-frontend ./
|
||||
# This seems to be the most expensive step
|
||||
@@ -62,10 +61,11 @@ ENV LANG=C.UTF-8 \
|
||||
SUPERSET_HOME="/app/superset_home" \
|
||||
SUPERSET_PORT=8088
|
||||
|
||||
RUN mkdir -p ${PYTHONPATH} superset/static superset-frontend apache_superset.egg-info requirements \
|
||||
RUN --mount=target=/var/lib/apt/lists,type=cache \
|
||||
--mount=target=/var/cache/apt,type=cache \
|
||||
mkdir -p ${PYTHONPATH} superset/static superset-frontend apache_superset.egg-info requirements \
|
||||
&& useradd --user-group -d ${SUPERSET_HOME} -m --no-log-init --shell /bin/bash superset \
|
||||
&& apt-get update -q \
|
||||
&& apt-get install -yq --no-install-recommends \
|
||||
&& apt-get update -qq && apt-get install -yqq --no-install-recommends \
|
||||
build-essential \
|
||||
curl \
|
||||
default-libmysqlclient-dev \
|
||||
@@ -74,27 +74,30 @@ RUN mkdir -p ${PYTHONPATH} superset/static superset-frontend apache_superset.egg
|
||||
libpq-dev \
|
||||
libecpg-dev \
|
||||
libldap2-dev \
|
||||
&& apt-get autoremove -yqq --purge && rm -rf /var/lib/apt/lists/* /var/[log,tmp]/* /tmp/* && apt-get clean \
|
||||
&& touch superset/static/version_info.json \
|
||||
&& chown -R superset:superset ./*
|
||||
|
||||
COPY --chown=superset:superset ./requirements/*.txt requirements/
|
||||
COPY --chown=superset:superset setup.py MANIFEST.in README.md ./
|
||||
# setup.py uses the version information in package.json
|
||||
COPY --chown=superset:superset superset-frontend/package.json superset-frontend/
|
||||
RUN pip install --no-cache-dir -r requirements/local.txt
|
||||
RUN --mount=type=bind,target=./requirements/local.txt,src=./requirements/local.txt \
|
||||
--mount=type=bind,target=./requirements/development.txt,src=./requirements/development.txt \
|
||||
--mount=type=bind,target=./requirements/base.txt,src=./requirements/base.txt \
|
||||
--mount=type=cache,target=/root/.cache/pip \
|
||||
pip install -r requirements/local.txt
|
||||
|
||||
COPY --chown=superset:superset --from=superset-node /app/superset/static/assets superset/static/assets
|
||||
## Lastly, let's install superset itself
|
||||
COPY --chown=superset:superset superset superset
|
||||
RUN pip install --no-cache-dir -e . \
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
pip install -e . \
|
||||
&& flask fab babel-compile --target superset/translations \
|
||||
&& chown -R superset:superset superset/translations
|
||||
|
||||
COPY --chmod=755 ./docker/run-server.sh /usr/bin/
|
||||
USER superset
|
||||
|
||||
HEALTHCHECK CMD curl -f "http://localhost:$SUPERSET_PORT/health"
|
||||
HEALTHCHECK CMD curl -f "http://localhost:${SUPERSET_PORT}/health"
|
||||
|
||||
EXPOSE ${SUPERSET_PORT}
|
||||
|
||||
@@ -109,8 +112,9 @@ ARG GECKODRIVER_VERSION=v0.33.0 \
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get update -q \
|
||||
&& apt-get install -yq --no-install-recommends \
|
||||
RUN --mount=target=/var/lib/apt/lists,type=cache \
|
||||
--mount=target=/var/cache/apt,type=cache \
|
||||
apt-get install -yqq --no-install-recommends \
|
||||
libnss3 \
|
||||
libdbus-glib-1-2 \
|
||||
libgtk-3-0 \
|
||||
@@ -119,14 +123,16 @@ RUN apt-get update -q \
|
||||
libxtst6 \
|
||||
wget \
|
||||
# Install GeckoDriver WebDriver
|
||||
&& wget https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -O - | tar xfz - -C /usr/local/bin \
|
||||
&& wget -q https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -O - | tar xfz - -C /usr/local/bin \
|
||||
# Install Firefox
|
||||
&& wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 -O - | tar xfj - -C /opt \
|
||||
&& wget -q https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 -O - | tar xfj - -C /opt \
|
||||
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox \
|
||||
&& apt-get autoremove -yqq --purge wget && rm -rf /var/lib/apt/lists/* /var/[log,tmp]/* /tmp/* && apt-get clean
|
||||
|
||||
&& apt-get autoremove -yqq --purge wget && rm -rf /var/[log,tmp]/* /tmp/*
|
||||
# Cache everything for dev purposes...
|
||||
RUN pip install --no-cache-dir -r requirements/docker.txt
|
||||
RUN --mount=type=bind,target=./requirements/base.txt,src=./requirements/base.txt \
|
||||
--mount=type=bind,target=./requirements/docker.txt,src=./requirements/docker.txt \
|
||||
--mount=type=cache,target=/root/.cache/pip \
|
||||
pip install -r requirements/docker.txt
|
||||
|
||||
USER superset
|
||||
######################################################################
|
||||
|
||||
Reference in New Issue
Block a user