From cc2f07e86f7323e5ba5fb6e9af502920c51c4530 Mon Sep 17 00:00:00 2001 From: CarboxyDev Date: Wed, 11 Feb 2026 22:25:16 +0530 Subject: [PATCH 1/2] Split CI docker validation into separate workflow + Cache docker builds --- .github/workflows/ci.yml | 26 ---------- .github/workflows/docker-build.yml | 49 ++++++++++++++++++ create-blitzpack/src/ci-workflow-template.ts | 27 ---------- create-blitzpack/src/constants.ts | 1 + .../src/docker-ci-workflow-template.ts | 50 +++++++++++++++++++ create-blitzpack/src/transform.ts | 21 ++++++++ 6 files changed, 121 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/docker-build.yml create mode 100644 create-blitzpack/src/docker-ci-workflow-template.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c3ce39..d64b162 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,29 +153,3 @@ jobs: BETTER_AUTH_SECRET: 'test-secret-minimum-32-characters-long-for-ci' BETTER_AUTH_URL: 'http://localhost:8080' NEXT_PUBLIC_API_URL: 'http://localhost:8080/api' - - docker-build: - runs-on: ubuntu-latest - needs: [lint, typecheck] - if: github.event_name == 'pull_request' - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build API image - uses: docker/build-push-action@v6 - with: - context: . - file: ./apps/api/Dockerfile - push: false - - - name: Build Web image - uses: docker/build-push-action@v6 - with: - context: . - file: ./apps/web/Dockerfile - push: false - build-args: | - NEXT_PUBLIC_API_URL=http://localhost:8080/api diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..4a52bf8 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,49 @@ +name: Docker Build + +on: + pull_request: + branches: [main, development] + push: + branches: [main] + +# Cancel in-progress runs when a new commit is pushed +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-api: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build API image + uses: docker/build-push-action@v6 + with: + context: . + file: ./apps/api/Dockerfile + push: false + cache-from: type=gha + cache-to: type=gha,mode=max + + build-web: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Web image + uses: docker/build-push-action@v6 + with: + context: . + file: ./apps/web/Dockerfile + push: false + build-args: | + NEXT_PUBLIC_API_URL=http://localhost:8080/api + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/create-blitzpack/src/ci-workflow-template.ts b/create-blitzpack/src/ci-workflow-template.ts index 816eb51..f3cf5a2 100644 --- a/create-blitzpack/src/ci-workflow-template.ts +++ b/create-blitzpack/src/ci-workflow-template.ts @@ -156,31 +156,4 @@ jobs: BETTER_AUTH_URL: 'http://localhost:8080' NEXT_PUBLIC_API_URL: 'http://localhost:8080/api' - # @feature dockerDeploy - docker-build: - runs-on: ubuntu-latest - needs: [lint, typecheck] - if: github.event_name == 'pull_request' - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build API image - uses: docker/build-push-action@v6 - with: - context: . - file: ./apps/api/Dockerfile - push: false - - - name: Build Web image - uses: docker/build-push-action@v6 - with: - context: . - file: ./apps/web/Dockerfile - push: false - build-args: | - NEXT_PUBLIC_API_URL=http://localhost:8080/api - # @endfeature `; diff --git a/create-blitzpack/src/constants.ts b/create-blitzpack/src/constants.ts index 739aab3..b8ea632 100644 --- a/create-blitzpack/src/constants.ts +++ b/create-blitzpack/src/constants.ts @@ -105,6 +105,7 @@ export const FEATURE_EXCLUSIONS: Record = { 'apps/api/Dockerfile', 'apps/web/Dockerfile', 'deploy/docker', + '.github/workflows/docker-build.yml', ], ciCd: ['.github/workflows/cd.yml'], }; diff --git a/create-blitzpack/src/docker-ci-workflow-template.ts b/create-blitzpack/src/docker-ci-workflow-template.ts new file mode 100644 index 0000000..e8a635b --- /dev/null +++ b/create-blitzpack/src/docker-ci-workflow-template.ts @@ -0,0 +1,50 @@ +export const DOCKER_CI_WORKFLOW_TEMPLATE = `name: Docker Build + +on: + pull_request: + branches: [main, development] + push: + branches: [main] + +# Cancel in-progress runs when a new commit is pushed +concurrency: + group: \${{ github.workflow }}-\${{ github.ref }} + cancel-in-progress: true + +jobs: + build-api: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build API image + uses: docker/build-push-action@v6 + with: + context: . + file: ./apps/api/Dockerfile + push: false + cache-from: type=gha + cache-to: type=gha,mode=max + + build-web: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Web image + uses: docker/build-push-action@v6 + with: + context: . + file: ./apps/web/Dockerfile + push: false + build-args: | + NEXT_PUBLIC_API_URL=http://localhost:8080/api + cache-from: type=gha + cache-to: type=gha,mode=max +`; diff --git a/create-blitzpack/src/transform.ts b/create-blitzpack/src/transform.ts index e278995..7264fe7 100644 --- a/create-blitzpack/src/transform.ts +++ b/create-blitzpack/src/transform.ts @@ -9,6 +9,7 @@ import { REPLACEABLE_FILES, type TemplateVariables, } from './constants.js'; +import { DOCKER_CI_WORKFLOW_TEMPLATE } from './docker-ci-workflow-template.js'; const TESTING_SCRIPTS = [ 'test', @@ -42,6 +43,7 @@ const TESTING_FILE_PATTERNS = [ const TS_CONFIG_FILE_PATTERN = /^tsconfig(?:\.[^.]+)?\.json$/; const AGENT_DOC_TARGETS = ['CLAUDE.md', 'AGENTS.md']; const CI_WORKFLOW_RELATIVE_PATH = '.github/workflows/ci.yml'; +const DOCKER_CI_WORKFLOW_RELATIVE_PATH = '.github/workflows/docker-build.yml'; const MARKER_FILES = [ 'apps/api/src/app.ts', @@ -283,6 +285,7 @@ async function applyFeatureTransforms( } await transformCiWorkflow(targetDir, disabledFeatures); + await transformDockerCiWorkflow(targetDir, features); await transformAgentDocs(targetDir, disabledFeatures); } @@ -515,3 +518,21 @@ async function transformCiWorkflow( content = cleanEmptyLines(content).trimEnd() + '\n'; await fs.writeFile(workflowPath, content, 'utf-8'); } + +async function transformDockerCiWorkflow( + targetDir: string, + features: FeatureOptions +): Promise { + const workflowPath = path.join(targetDir, DOCKER_CI_WORKFLOW_RELATIVE_PATH); + + if (!features.dockerDeploy) { + if (await fs.pathExists(workflowPath)) { + await fs.remove(workflowPath); + } + return; + } + + await fs.ensureDir(path.dirname(workflowPath)); + const content = DOCKER_CI_WORKFLOW_TEMPLATE.trimEnd() + '\n'; + await fs.writeFile(workflowPath, content, 'utf-8'); +} From 7e8d44110a3471b573a6750e5d3cd1cfd8e28322 Mon Sep 17 00:00:00 2001 From: CarboxyDev Date: Wed, 11 Feb 2026 22:28:01 +0530 Subject: [PATCH 2/2] Bump create-blitzpack version to v0.1.18 --- create-blitzpack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create-blitzpack/package.json b/create-blitzpack/package.json index c340b1d..725385b 100644 --- a/create-blitzpack/package.json +++ b/create-blitzpack/package.json @@ -1,6 +1,6 @@ { "name": "create-blitzpack", - "version": "0.1.17", + "version": "0.1.18", "description": "Create a new Blitzpack project - full-stack TypeScript monorepo with Next.js and Fastify", "type": "module", "bin": {