Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

ff main: no Docker file edits from contributors

Nahuel990be778de48acb
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1dcff345..18709c46 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,6 +14,36 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ no-image-build:
+ name: no image build
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - uses: actions/checkout@v4
+ # MiniStack runs containers from images it names; it never builds one.
+ # A request body must never reach a build context, so no source file may
+ # call a Docker build at all. This blocks the capability, not a misuse.
+ - name: Reject any Docker image build in the served source tree
+ run: |
+ if grep -rnE '\.images\.build\(|\bbuildx\b|docker[[:space:]]+build\b|APIClient\(.*\)\.build\(' \
+ ministack/ 2>/dev/null; then
+ echo "::error::MiniStack must never build a Docker image. Run images it names instead."
+ exit 1
+ fi
+
+ # Only the two release images at the repository root may exist. Any other
+ # Dockerfile is a build input nobody is allowed to introduce, and one
+ # outside the root does not trip the preview-build path guard either.
+ - name: Reject any Dockerfile outside the two release images
+ run: |
+ extra=$(git ls-files -- '*Dockerfile' '*Dockerfile.*' '*dockerfile' \
+ | grep -vE '^(Dockerfile|Dockerfile\.full)$' || true)
+ if [ -n "$extra" ]; then
+ echo "$extra"
+ echo "::error::Only Dockerfile and Dockerfile.full may exist. MiniStack never builds an image."
+ exit 1
+ fi
+
control-plane:
name: control plane
runs-on: ubuntu-latest
@@ -259,7 +289,7 @@ jobs:
test-result:
name: test
- needs: [control-plane, data-plane]
+ needs: [control-plane, data-plane, no-image-build]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -267,3 +297,4 @@ jobs:
- run: |
test "${{ needs['control-plane'].result }}" = "success"
test "${{ needs['data-plane'].result }}" = "success"
+ test "${{ needs['no-image-build'].result }}" = "success"
diff --git a/.github/workflows/docker-publish-on-pr.yml b/.github/workflows/docker-publish-on-pr.yml
index 531e67ab..995f4343 100644
--- a/.github/workflows/docker-publish-on-pr.yml
+++ b/.github/workflows/docker-publish-on-pr.yml
@@ -41,6 +41,7 @@ jobs:
skip_preview() {
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "plugin_changed=false" >> "$GITHUB_OUTPUT"
+ echo "docker_change=${2:-false}" >> "$GITHUB_OUTPUT"
echo "skip_reason=$1" >> "$GITHUB_OUTPUT"
echo "::warning::$1"
exit 0
@@ -70,14 +71,23 @@ jobs:
echo "Changed files:"
printf '%s' "$files" | jq -r '.[][] | .filename'
+ # Deliberately unanchored: a Dockerfile in any path is a build input,
+ # and one is never auto-built from a PR regardless of where it lives.
if printf '%s' "$files" | jq -e \
- 'any(.[][]; .filename | test("^(Dockerfile([.].*)?|[.]dockerignore|[.]github/)"))' \
+ 'any(.[][]; .filename | test("(^|/)[Dd]ockerfile([.][^/]*)?$"))' \
+ >/dev/null; then
+ skip_preview "this PR creates or modifies a Dockerfile." true
+ fi
+
+ if printf '%s' "$files" | jq -e \
+ 'any(.[][]; .filename | test("^([.]dockerignore|[.]github/)"))' \
>/dev/null; then
skip_preview "PR modifies the build/CI surface; auto-preview skipped pending manual maintainer build."
fi
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "skip_reason=" >> "$GITHUB_OUTPUT"
+ echo "docker_change=false" >> "$GITHUB_OUTPUT"
if printf '%s' "$files" | jq -e \
'any(.[][]; .filename | test("^contrib/mysql-iam-plugin/"))' \
>/dev/null; then
@@ -87,7 +97,16 @@ jobs:
fi
- name: Comment that auto-preview was skipped
- if: steps.guard.outputs.skip == 'true'
+ if: steps.guard.outputs.skip == 'true' && steps.guard.outputs.docker_change != 'true'
+ uses: marocchino/sticky-pull-request-comment@v3
+ with:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ header: docker-preview
+ message: |
+ Auto-preview build skipped: ${{ steps.guard.outputs.skip_reason }}
+
+ - name: Comment that a Dockerfile change is not accepted
+ if: steps.guard.outputs.docker_change == 'true'
uses: marocchino/sticky-pull-request-comment@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -95,6 +114,11 @@ jobs:
message: |
Auto-preview build skipped: ${{ steps.guard.outputs.skip_reason }}
+ MiniStack runs containers from images it names and never builds one,
+ so a Dockerfile in any path is not accepted through a pull request.
+ Please open an issue first stating what you want to achieve, and we
+ will agree the approach there before any code changes.
+
# checkout@v6 now refuses fork-PR checkouts from pull_request_target
# unless explicitly allowed, which has failed this job for every fork PR
# since 2026-07-20. Checking out the PR head is intentional here: the