diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a8f94cbc472..b00c55226b1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1256,6 +1256,7 @@ embed.go @grafana/grafana-as-code /.github/zizmor.yml @grafana/grafana-developer-enablement-squad /.github/license_finder.yaml @bergquist /.github/actionlint.yaml @grafana/grafana-developer-enablement-squad +/.github/workflows/pr-test-docker.yml @grafana/grafana-developer-enablement-squad # Generated files not requiring owner approval /packages/grafana-data/src/types/featureToggles.gen.ts @grafanabot diff --git a/.github/actions/change-detection/action.yml b/.github/actions/change-detection/action.yml index 67b63bfe363..0832c5d3821 100644 --- a/.github/actions/change-detection/action.yml +++ b/.github/actions/change-detection/action.yml @@ -28,6 +28,9 @@ outputs: docs: description: Whether the docs or self have changed in any way value: ${{ steps.changed-files.outputs.docs_any_changed || 'true' }} + dockerfile: + description: Whether the dockerfile or self have changed in any way + value: ${{ steps.changed-files.outputs.dockerfile_any_changed || 'true' }} runs: using: composite steps: @@ -42,6 +45,8 @@ runs: self: - '.github/actions/change-detection/**' - '${{ inputs.self }}' + dockerfile: + - 'Dockerfile' backend: - '!*.md' - '!docs/**' @@ -151,3 +156,5 @@ runs: echo " --> ${{ steps.changed-files.outputs.dev_tooling_all_changed_files }}" echo "Docs: ${{ steps.changed-files.outputs.docs_any_changed || 'true' }}" echo " --> ${{ steps.changed-files.outputs.docs_all_changed_files }}" + echo "Dockerfile: ${{ steps.changed-files.outputs.dockerfile_any_changed || 'true' }}" + echo " --> ${{ steps.changed-files.outputs.dockerfile_all_changed_files }}" diff --git a/.github/workflows/pr-test-docker.yml b/.github/workflows/pr-test-docker.yml new file mode 100644 index 00000000000..66246310d55 --- /dev/null +++ b/.github/workflows/pr-test-docker.yml @@ -0,0 +1,39 @@ +name: Test Dockerfile + +on: + pull_request: + +jobs: + detect-changes: + # Run on `grafana/grafana` main branch, or on pull requests to prevent double-running on mirrors + name: Detect whether code changed + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + changed: ${{ steps.detect-changes.outputs.backend || steps.detect-changes.outputs.frontend || steps.detect-changes.outputs.dockerfile }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: true # required to get more history in the changed-files action + fetch-depth: 2 + - name: Detect changes + id: detect-changes + uses: ./.github/actions/change-detection + with: + self: .github/workflows/pr-test-integration.yml + + build-dockerfile: + needs: detect-changes + if: needs.detect-changes.outputs.changed == 'true' + runs-on: ubuntu-x64-large-io + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: docker/setup-docker-action@b60f85385d03ac8acfca6d9996982511d8620a19 # v4 + - name: Build Dockerfile + run: make build-docker-full diff --git a/Dockerfile b/Dockerfile index 4cdab806589..1c4e39f74fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,15 +28,17 @@ ENV NODE_OPTIONS=--max_old_space_size=8000 WORKDIR /tmp/grafana +RUN apk add --no-cache make build-base python3 + COPY package.json project.json nx.json yarn.lock .yarnrc.yml ./ COPY .yarn .yarn COPY packages packages +COPY e2e-playwright e2e-playwright COPY public public COPY LICENSE ./ COPY conf/defaults.ini ./conf/defaults.ini COPY e2e e2e -RUN apk add --no-cache make build-base python3 # # Set the node env according to defaults or argument passed #