diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000000..10cca7b834f1c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,58 @@ +name: "Docker Images" + +on: + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize] + +env: + AWS_REGION: eu-west-1 + +jobs: + build-image: + name: Build, Tag and Upload + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create dist directory + run: mkdir dist + + - name: Compute labels + run: | + TAG_HASH="$(echo $GITHUB_SHA | head -c 8)" + TAG_NAME="$(echo $GITHUB_REF | sed -E -e 's:refs/pull/([0-9]+)/merge:pr.\1:' -e 's:refs/heads/::' -e 's:tag/v?([.0-9]+):v\1:' -e 's:/:.:')" + SUPERSET_REPOSITORY_URI="289222877357.dkr.ecr.eu-west-1.amazonaws.com/webgains/superset" + echo "TAG_HASH=$TAG_HASH" >> $GITHUB_ENV + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV + echo "SUPERSET_REPOSITORY_URI=$SUPERSET_REPOSITORY_URI" >> $GITHUB_ENV + if [ $TAG_NAME = "main" ]; then echo "LATEST_TAG=$SUPERSET_REPOSITORY_URI:latest" >> $GITHUB_ENV; fi + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4.0.2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2.0.1 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: | + ${{ env.SUPERSET_REPOSITORY_URI }}:${{ env.TAG_HASH }} + ${{ env.SUPERSET_REPOSITORY_URI }}:${{ env.TAG_NAME }} + ${{ env.LATEST_TAG }} diff --git a/Dockerfile b/Dockerfile index cd859490d32b9..be0789a83f90a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,7 +47,6 @@ RUN --mount=type=bind,target=./package.json,src=./superset-frontend/package.json # Runs the webpack build process COPY superset-frontend /app/superset-frontend -RUN npm run ${BUILD_CMD} # This copies the .po files needed for translation RUN mkdir -p /app/superset/translations @@ -57,6 +56,8 @@ RUN npm run build-translation RUN rm /app/superset/translations/*/LC_MESSAGES/*.po RUN rm /app/superset/translations/messages.pot +RUN npm run ${BUILD_CMD} + ###################################################################### # Final lean image... ###################################################################### diff --git a/superset-frontend/src/constants.ts b/superset-frontend/src/constants.ts index 14a22b4a33c41..296db9cc16224 100644 --- a/superset-frontend/src/constants.ts +++ b/superset-frontend/src/constants.ts @@ -113,12 +113,12 @@ export const URL_PARAMS = { }, language: { name: 'lang', - type: 'string' + type: 'string', }, currency: { name: 'currency', - type: 'string' - } + type: 'string', + }, } as const; export const RESERVED_CHART_URL_PARAMS: string[] = [ diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx index 8437e66b0c807..6f666b7fb1aa1 100644 --- a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx +++ b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx @@ -444,12 +444,12 @@ const DashboardBuilder: FC = () => { const fireResizeEventToParent = () => { const data = { - event: "supersetContentRefreshed", - width: window.document.body.scrollWidth, - height: window.document.body.scrollHeight, - } - window.parent.postMessage(data, "*"); - } + event: 'supersetContentRefreshed', + width: window.document.body.scrollWidth, + height: window.document.body.scrollHeight, + }; + window.parent.postMessage(data, '*'); + }; useEffect(() => { setBarTopOffset(headerRef.current?.getBoundingClientRect()?.height || 0); diff --git a/superset-frontend/webpack.config.js b/superset-frontend/webpack.config.js index c4f7952c0e631..f3074032b64bc 100644 --- a/superset-frontend/webpack.config.js +++ b/superset-frontend/webpack.config.js @@ -252,7 +252,7 @@ const config = { }, }, output, - stats: 'minimal', + stats: 'none', /* Silence warning for missing export in @data-ui's internal structure. This issue arises from an internal implementation detail of @data-ui. As it's