Skip to content

Commit

Permalink
Skip translations build within lean image if requested
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Sep 9, 2024
1 parent e75dca1 commit c4f41db
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ RUN rm /app/superset/translations/messages.pot
######################################################################
FROM python:${PY_VER} AS lean

# Include translations in the final build. The default supports en only to
# reduce complexity and weight for those only using en
ARG BUILD_TRANSLATIONS="false"

WORKDIR /app
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
Expand Down Expand Up @@ -138,10 +142,14 @@ COPY --chown=superset:superset --from=superset-node /app/superset/translations s

# Compile translations for the backend - this generates .mo files, then deletes the .po files
COPY ./scripts/translations/generate_mo_files.sh ./scripts/translations/
RUN ./scripts/translations/generate_mo_files.sh \
&& chown -R superset:superset superset/translations \
&& rm superset/translations/messages.pot \
&& rm superset/translations/*/LC_MESSAGES/*.po
RUN if [ "$BUILD_TRANSLATIONS" = "true" ]; then \
./scripts/translations/generate_mo_files.sh \
&& chown -R superset:superset superset/translations \
&& rm superset/translations/messages.pot \
&& rm superset/translations/*/LC_MESSAGES/*.po; \
else \
echo "Skipping translations as requested by build flag"; \
fi

COPY --chmod=755 ./docker/run-server.sh /usr/bin/
USER superset
Expand Down

0 comments on commit c4f41db

Please sign in to comment.