You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2024/08/27 01:23:01 UTC

(superset) branch accelerate_docker_compose created (now d7bf2df133)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a change to branch accelerate_docker_compose
in repository https://gitbox.apache.org/repos/asf/superset.git


      at d7bf2df133 chore: accelerate docker compose by skipping frontend build

This branch includes the following new commits:

     new d7bf2df133 chore: accelerate docker compose by skipping frontend build

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: chore: accelerate docker compose by skipping frontend build

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch accelerate_docker_compose
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d7bf2df133af42ef2fd46aa5bd3bc424dfa656a3
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Aug 26 17:51:04 2024 -0700

    chore: accelerate docker compose by skipping frontend build
    
    while waiting for a `docker-compose build`, I decided to go and skip the long steps around the frontend buildsthat are not required while in dev mode while using  `docker-compose` where we mount the local repo and build it inside docker.
---
 Dockerfile         | 21 ++++++++++++++++++---
 docker-compose.yml |  2 ++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index cd859490d3..588274fb53 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,6 +26,8 @@ FROM --platform=${BUILDPLATFORM} node:20-bullseye-slim AS superset-node
 
 ARG NPM_BUILD_CMD="build"
 
+ARG DEV_MODE=false
+
 # Somehow we need python3 + build-essential on this side of the house to install node-gyp
 RUN apt-get update -qq \
     && apt-get install \
@@ -41,19 +43,32 @@ RUN --mount=type=bind,target=/frontend-mem-nag.sh,src=./docker/frontend-mem-nag.
     /frontend-mem-nag.sh
 
 WORKDIR /app/superset-frontend
+RUN mkdir -p /app/superset/static/assets && mkdir -p /app/superset/translations
 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
+    if [ "$DEV_MODE" = "false" ]; then \
+        npm ci; \
+    else \
+        echo "Skipping npm ci in dev mode"; \
+    fi
 
 # Runs the webpack build process
 COPY superset-frontend /app/superset-frontend
-RUN npm run ${BUILD_CMD}
+RUN if [ "$DEV_MODE" = "false" ]; then \
+        npm run ${BUILD_CMD}; \
+    else \
+        echo "Skipping npm run ${BUILD_CMD} in dev mode"; \
+    fi
 
 # This copies the .po files needed for translation
 RUN mkdir -p /app/superset/translations
 COPY superset/translations /app/superset/translations
 # Compiles .json files from the .po files, then deletes the .po files
-RUN npm run build-translation
+RUN if [ "$DEV_MODE" = "false" ]; then \
+        npm run build-translation; \
+    else \
+        echo "Skipping translations in dev mode"; \
+    fi
 RUN rm /app/superset/translations/*/LC_MESSAGES/*.po
 RUN rm /app/superset/translations/messages.pot
 
diff --git a/docker-compose.yml b/docker-compose.yml
index d0121fa874..ff1c4f3703 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -38,6 +38,8 @@ x-common-build: &common-build
   target: dev
   cache_from:
     - apache/superset-cache:3.10-slim-bookworm
+  args:
+    DEV_MODE: "true"
 
 services:
   nginx: