diff --git a/Dockerfile b/Dockerfile index cd859490d32b9..588274fb53a6d 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 d0121fa874622..ff1c4f3703cc6 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: