Skip to content

Commit

Permalink
chore(docker): Reduce image size and update GECKODRIVER_VERSION ,FIRE… (
Browse files Browse the repository at this point in the history
  • Loading branch information
alekseyolg authored and EnxDev committed May 31, 2024
1 parent ce751cc commit a197b1a
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ ENV LANG=C.UTF-8 \
RUN mkdir -p ${PYTHONPATH} superset/static requirements superset-frontend apache_superset.egg-info requirements \
&& useradd --user-group -d ${SUPERSET_HOME} -m --no-log-init --shell /bin/bash superset \
&& apt-get update -qq && apt-get install -yqq --no-install-recommends \
build-essential \
curl \
default-libmysqlclient-dev \
libsasl2-dev \
Expand All @@ -81,8 +80,12 @@ COPY --chown=superset:superset pyproject.toml setup.py MANIFEST.in README.md ./
COPY --chown=superset:superset superset-frontend/package.json superset-frontend/
COPY --chown=superset:superset requirements/base.txt requirements/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade setuptools pip && \
pip install -r requirements/base.txt
apt-get update -qq && apt-get install -yqq --no-install-recommends \
build-essential \
&& pip install --upgrade setuptools pip \
&& pip install -r requirements/base.txt \
&& apt-get autoremove -yqq --purge build-essential \
&& rm -rf /var/lib/apt/lists/*

COPY --chown=superset:superset --from=superset-node /app/superset/static/assets superset/static/assets
## Lastly, let's install superset itself
Expand All @@ -105,11 +108,8 @@ CMD ["/usr/bin/run-server.sh"]
# Dev image...
######################################################################
FROM lean AS dev
ARG GECKODRIVER_VERSION=v0.33.0 \
FIREFOX_VERSION=117.0.1

USER root

RUN apt-get update -qq \
&& apt-get install -yqq --no-install-recommends \
libnss3 \
Expand All @@ -118,25 +118,35 @@ RUN apt-get update -qq \
libx11-xcb1 \
libasound2 \
libxtst6 \
wget \
git \
pkg-config
pkg-config \
&& rm -rf /var/lib/apt/lists/*

RUN pip install playwright
RUN --mount=type=cache,target=/root/.cache/pip \
pip install playwright
RUN playwright install-deps
RUN playwright install chromium

# Install GeckoDriver WebDriver
RUN wget -q https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -O - | tar xfz - -C /usr/local/bin \
ARG GECKODRIVER_VERSION=v0.34.0 \
FIREFOX_VERSION=125.0.3

RUN apt-get update -qq \
&& apt-get install -yqq --no-install-recommends wget bzip2 \
&& 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 -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/[log,tmp]/* /tmp/* /var/lib/apt/lists/*
&& apt-get autoremove -yqq --purge wget bzip2 && rm -rf /var/[log,tmp]/* /tmp/* /var/lib/apt/lists/*
# Cache everything for dev purposes...

COPY --chown=superset:superset requirements/development.txt requirements/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements/development.txt
apt-get update -qq && apt-get install -yqq --no-install-recommends \
build-essential \
&& pip install -r requirements/development.txt \
&& apt-get autoremove -yqq --purge build-essential \
&& rm -rf /var/lib/apt/lists/*

USER superset
######################################################################
Expand Down

0 comments on commit a197b1a

Please sign in to comment.