Skip to content

Instantly share code, notes, and snippets.

@SyNeto
Created November 18, 2025 18:09
Show Gist options
  • Select an option

  • Save SyNeto/972f4941a1dcdf186363681437f34b66 to your computer and use it in GitHub Desktop.

Select an option

Save SyNeto/972f4941a1dcdf186363681437f34b66 to your computer and use it in GitHub Desktop.
Strapi CMS build error - config-dist directory not found

Build Error Evidence - test-encryption Deployment

Summary

Error: Docker build failed trying to copy non-existent directory config-dist

error building image: error building stage: failed to optimize instructions: 
failed to get files used from context: failed to get fileinfo for /kaniko/0/app/config-dist: 
lstat /kaniko/0/app/config-dist: no such file or directory

Key Information

  • App ID: 7d776ca6-ff06-454c-b8f4-0454fccd0910
  • Deployment ID: 9efb1b70-265c-4d16-b783-f48fc761bdae
  • Branch: main
  • Commit: 6b64ed346cdffbbcc36a763cba2c639d52782fc8
  • Dockerfile: Dockerfile.prod

Root Cause

The Dockerfile.prod has a multi-stage build that tries to copy config-dist from the builder stage:

COPY --from=builder /app/config-dist ./config-dist

But this directory doesn't exist. It appears there were recent changes to directory naming conventions that weren't reflected in the Dockerfile.

What to Check

  1. Review Dockerfile.prod - Look for COPY statements referencing config-dist
  2. Check if directory was renamed - Maybe config-dist was renamed to dist/config or similar
  3. Review recent commits - Changes around directory structure for develop/staging builds

Build Log Highlights

Successful Steps:

  • ✅ Git repo clone (commit 6b64ed3)
  • ✅ npm ci (installed 1827 packages)
  • ✅ TypeScript compilation (8105ms)
  • ✅ Admin panel build (39617ms)
  • ✅ tsconfig.config.json compilation

Warnings (non-blocking):

  • Verification code settings using DEFAULT values (expected for ephemeral)
  • 33 npm vulnerabilities (separate issue)

Failed Step:

  • ❌ Multi-stage build: Second stage failed when trying to copy config-dist

Files to Review

  • /cms/Dockerfile.prod - Check COPY statements
  • /cms/config/ - Directory structure
  • Recent commits affecting build/config structure

Environment Variables Confirmed Working

All 37 environment variables were correctly passed to the build:

  • DATABASE_* (8 vars)
  • SPACES_* (5 vars)
  • APP_KEYS, JWT_SECRET, ADMIN_JWT_SECRET, API_TOKEN_SALT, TRANSFER_TOKEN_SALT, ENCRYPTION_KEY
  • SMTP_* (5 vars)
  • TWILIO_* (3 vars)
  • VERIFICATION_CODE_* (3 vars)
  • NODE_ENV, ENVIRONMENT_NAME, ENVIRONMENT_TYPE, STRAPI_TELEMETRY_DISABLED

Infrastructure Status

  • ✅ Terraform configuration valid
  • ✅ ENCRYPTION_KEY added and configured
  • ✅ Destroy workflows simplified (removed unnecessary secrets)
  • ✅ Environment variables properly passed

Action Required

Fix Dockerfile.prod to match current directory structure after recent refactoring.


Generated: 2025-11-18T04:38:13Z

2025-11-18T04:34:36.184836925Z ╭──────────── git repo clone ───────────╼
2025-11-18T04:34:36.184878328Z │  › fetching app source code
2025-11-18T04:34:36.184884722Z │ => Selecting branch "main"
2025-11-18T04:34:36.184889335Z │ => Checking out commit "6b64ed346cdffbbcc36a763cba2c639d52782fc8"
2025-11-18T04:34:36.184893342Z │
2025-11-18T04:34:36.184897421Z │  ✔ cloned repo to /.app_platform_workspace
2025-11-18T04:34:36.184903158Z ╰────────────────────────────────────────╼
2025-11-18T04:34:36.184908455Z
2025-11-18T04:34:36.580541575Z  › configuring build-time app environment variables:
2025-11-18T04:34:36.580575195Z DATABASE_SSL_REJECT_UNAUTHORIZED VERIFICATION_CODE_CHARSET DATABASE_PASSWORD APP_KEYS SMTP_USERNAME SMTP_HOST ADMIN_JWT_SECRET TWILIO_ACCOUNT_SID TWILIO_AUTH_TOKEN VERIFICATION_CODE_LENGTH ENVIRONMENT_NAME STRAPI_TELEMETRY_DISABLED SMTP_PASSWORD NODE_ENV DATABASE_SSL DATABASE_POOL_MIN TRANSFER_TOKEN_SALT API_TOKEN_SALT TWILIO_PHONE_NUMBER JWT_SECRET ENCRYPTION_KEY SMTP_REPLY_TO DATABASE_USERNAME SPACES_SECRET_KEY SMTP_PORT DATABASE_CLIENT DATABASE_POOL_MAX SPACES_ACCESS_KEY SMTP_FROM VERIFICATION_CODE_EXPIRATION_MINUTES ENVIRONMENT_TYPE DATABASE_HOST DATABASE_NAME SPACES_REGION SPACES_BUCKET DATABASE_PORT SPACES_PREFIX
2025-11-18T04:34:36.617911793Z ╭──────────── dockerfile build ───────────╼
2025-11-18T04:34:36.636859319Z │  › using dockerfile /.app_platform_workspace/Dockerfile.prod
2025-11-18T04:34:36.638251582Z │  › using build context /.app_platform_workspace/
2025-11-18T04:34:36.638575911Z │
2025-11-18T04:34:36.732803446Z │ INFO[0000] Resolved base name node:22-alpine to builder
2025-11-18T04:34:36.732830859Z │ INFO[0000] Resolved base name node:22-alpine to runner
2025-11-18T04:34:36.733350930Z │ INFO[0000] Using dockerignore file: /.app_platform_workspace/.dockerignore
2025-11-18T04:34:36.733372114Z │ INFO[0000] Retrieving image manifest node:22-alpine
2025-11-18T04:34:36.733375710Z │ INFO[0000] Retrieving image library/node:22-alpine from registry mirror <registry-uri-0>
2025-11-18T04:34:36.874979471Z │ INFO[0000] Retrieving image manifest node:22-alpine
2025-11-18T04:34:36.875007427Z │ INFO[0000] Returning cached image manifest
2025-11-18T04:34:36.878128938Z │ INFO[0000] Retrieving image manifest node:22-alpine
2025-11-18T04:34:36.878147093Z │ INFO[0000] Returning cached image manifest
2025-11-18T04:34:36.878160266Z │ INFO[0000] Retrieving image manifest node:22-alpine
2025-11-18T04:34:36.878163262Z │ INFO[0000] Returning cached image manifest
2025-11-18T04:34:36.878887105Z │ INFO[0000] Built cross stage deps: map[0:[/app/dist /app/public /app/config-dist /app/node_modules /app/database /app/src /app/package*.json /app/server.js]]
2025-11-18T04:34:36.878903127Z │ INFO[0000] Retrieving image manifest node:22-alpine
2025-11-18T04:34:36.878906694Z │ INFO[0000] Returning cached image manifest
2025-11-18T04:34:36.878909628Z │ INFO[0000] Retrieving image manifest node:22-alpine
2025-11-18T04:34:36.878912523Z │ INFO[0000] Returning cached image manifest
2025-11-18T04:34:36.878932087Z │ INFO[0000] Executing 0 build triggers
2025-11-18T04:34:36.879725452Z │ INFO[0000] Building stage 'node:22-alpine' [idx: '0', base-idx: '-1']
2025-11-18T04:34:36.879741929Z │ INFO[0000] Resolving srcs [package*.json]...
2025-11-18T04:34:36.884449904Z │ INFO[0000] Checking for cached layer <registry-uri-1>
2025-11-18T04:34:36.930081653Z │ INFO[0000] No cached layer found for cmd RUN npm ci
2025-11-18T04:34:36.962567607Z │ INFO[0000] Unpacking rootfs as cmd COPY package*.json ./ requires it.
2025-11-18T04:34:40.610557057Z │ INFO[0003] Initializing snapshotter ...
2025-11-18T04:34:40.610593195Z │ INFO[0003] Taking snapshot of full filesystem...
2025-11-18T04:34:41.329709156Z │ INFO[0004] WORKDIR /app
2025-11-18T04:34:41.329737747Z │ INFO[0004] Cmd: workdir
2025-11-18T04:34:41.329740683Z │ INFO[0004] Changed working directory to /app
2025-11-18T04:34:41.329743331Z │ INFO[0004] Creating directory /app with uid -1 and gid -1
2025-11-18T04:34:41.345899518Z │ INFO[0004] Taking snapshot of files...
2025-11-18T04:34:41.345924711Z │ INFO[0004] Resolving srcs [package*.json]...
2025-11-18T04:34:41.347837688Z │ INFO[0004] COPY package*.json ./
2025-11-18T04:34:41.347861960Z │ INFO[0004] Resolving srcs [package*.json]...
2025-11-18T04:34:41.362795806Z │ INFO[0004] Taking snapshot of files...
2025-11-18T04:34:41.390473490Z │ INFO[0004] RUN npm ci
2025-11-18T04:34:41.463698829Z │ INFO[0004] Cmd: /bin/sh
2025-11-18T04:34:41.463725811Z │ INFO[0004] Args: [-c npm ci]
2025-11-18T04:34:41.463728878Z │ INFO[0004] Running: [/bin/sh -c npm ci]
2025-11-18T04:34:51.407817743Z │ npm warn deprecated [email protected]: This project is unmaintained
2025-11-18T04:34:52.417040822Z │ npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
2025-11-18T04:34:54.563382770Z │ npm warn deprecated [email protected]: This project is unmaintained
2025-11-18T04:34:54.587439508Z │ npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
2025-11-18T04:34:59.524960328Z │ npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-11-18T04:34:59.787988819Z │ npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-11-18T04:35:00.368986164Z │ npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-11-18T04:35:01.626875594Z │ npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-11-18T04:35:01.627671783Z │ npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
2025-11-18T04:35:01.628355462Z │ npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
2025-11-18T04:35:46.018892172Z │
2025-11-18T04:35:46.018933897Z │ > [email protected] prepare
2025-11-18T04:35:46.018938118Z │ > husky
2025-11-18T04:35:46.018940917Z │
2025-11-18T04:35:46.100360793Z │ .git can't be found
2025-11-18T04:35:46.100473356Z │ added 1827 packages, and audited 1828 packages in 1m
2025-11-18T04:35:46.100480594Z │
2025-11-18T04:35:46.100485432Z │ 241 packages are looking for funding
2025-11-18T04:35:46.100490998Z │ run `npm fund` for details
2025-11-18T04:35:46.528593153Z │
2025-11-18T04:35:46.528616694Z │ 33 vulnerabilities (16 low, 4 moderate, 13 high)
2025-11-18T04:35:46.528620024Z │
2025-11-18T04:35:46.528623221Z │ To address issues that do not require attention, run:
2025-11-18T04:35:46.528626556Z │ npm audit fix
2025-11-18T04:35:46.528629466Z │
2025-11-18T04:35:46.528632242Z │ To address all issues possible (including breaking changes), run:
2025-11-18T04:35:46.528635557Z │ npm audit fix --force
2025-11-18T04:35:46.528638477Z │
2025-11-18T04:35:46.528641088Z │ Some issues need review, and may require choosing
2025-11-18T04:35:46.528643705Z │ a different dependency.
2025-11-18T04:35:46.528646254Z │
2025-11-18T04:35:46.528648876Z │ Run `npm audit` for details.
2025-11-18T04:35:46.530517034Z │ npm notice
2025-11-18T04:35:46.530522475Z │ npm notice New major version of npm available! 10.9.4 -> 11.6.2
2025-11-18T04:35:46.530525754Z │ npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.6.2
2025-11-18T04:35:46.530528381Z │ npm notice To update run: npm install -g [email protected]
2025-11-18T04:35:46.530530964Z │ npm notice
2025-11-18T04:35:52.545862812Z │ INFO[0075] Taking snapshot of files...
2025-11-18T04:36:35.348803594Z │ INFO[0118] COPY . .
2025-11-18T04:36:35.503798108Z │ INFO[0118] Taking snapshot of files...
2025-11-18T04:36:35.543194142Z │ INFO[0118] RUN npm run build
2025-11-18T04:36:37.533692692Z │ INFO[0120] Cmd: /bin/sh
2025-11-18T04:36:37.533723222Z │ INFO[0120] Args: [-c npm run build]
2025-11-18T04:36:37.533726527Z │ INFO[0120] Running: [/bin/sh -c npm run build]
2025-11-18T04:36:37.819411542Z │
2025-11-18T04:36:37.819443198Z │ > [email protected] build
2025-11-18T04:36:37.819448911Z │ > strapi build
2025-11-18T04:36:37.819452154Z │
2025-11-18T04:36:39.560276735Z │ INFO[0122] Pushing layer <registry-uri-2> to cache now
2025-11-18T04:36:39.560312698Z │ INFO[0122] Pushing image to <registry-uri-3>
2025-11-18T04:36:41.541493254Z │ - Compiling TS
2025-11-18T04:36:49.644112034Z │
2025-11-18T04:36:49.645853797Z │ ✔ Compiling TS (8105ms)
2025-11-18T04:36:49.645865334Z │ - Building build context
2025-11-18T04:36:49.659989459Z │
2025-11-18T04:36:49.660010283Z │ ⚠️ ========================================
2025-11-18T04:36:49.660625179Z │ ⚠️ SECURITY WARNING: INSECURE CONFIGURATION
2025-11-18T04:36:49.660632629Z │ ⚠️ ========================================
2025-11-18T04:36:49.660652871Z │ ⚠️
2025-11-18T04:36:49.661293023Z │ ⚠️ Verification code settings are using DEFAULT values.
2025-11-18T04:36:49.662042585Z │ ⚠️ This is INSECURE for production environments!
2025-11-18T04:36:49.662053340Z │ ⚠️
2025-11-18T04:36:49.662056614Z │ ⚠️ Please configure the following environment variables:
2025-11-18T04:36:49.662764548Z │ ⚠️
2025-11-18T04:36:49.662771555Z │ ⚠️ VERIFICATION_CODE_CHARSET=numeric | alphanumeric-safe
2025-11-18T04:36:49.662774767Z │ ⚠️ VERIFICATION_CODE_LENGTH=6
2025-11-18T04:36:49.662777585Z │ ⚠️ VERIFICATION_CODE_EXPIRATION_MINUTES=10
2025-11-18T04:36:49.662780214Z │ ⚠️
2025-11-18T04:36:49.663088113Z │ ⚠️ Current values (DEFAULTS):
2025-11-18T04:36:49.663092555Z │ ⚠️ Charset: numeric
2025-11-18T04:36:49.663095723Z │ ⚠️ Length: 6
2025-11-18T04:36:49.663098469Z │ ⚠️ Expiration: 10 minutes
2025-11-18T04:36:49.663101893Z │ ⚠️
2025-11-18T04:36:49.663104928Z │ ⚠️ See .env.example for configuration details.
2025-11-18T04:36:49.663107567Z │ ⚠️ ========================================
2025-11-18T04:36:49.663405194Z │
2025-11-18T04:36:49.763533269Z │ [INFO] Including the following ENV variables as part of the JS bundle:
2025-11-18T04:36:49.763562615Z │ - ADMIN_PATH
2025-11-18T04:36:49.763566977Z │ - STRAPI_ADMIN_BACKEND_URL
2025-11-18T04:36:49.763569806Z │ - STRAPI_TELEMETRY_DISABLED
2025-11-18T04:36:49.763572501Z │ - STRAPI_ANALYTICS_URL
2025-11-18T04:36:49.975850177Z │ ✔ Building build context (333ms)
2025-11-18T04:36:49.975879066Z │ - Building admin panel
2025-11-18T04:36:49.975882195Z │
2025-11-18T04:37:00.112055557Z │ INFO[0143] Pushed <registry-uri-4>
2025-11-18T04:37:29.592176511Z │ ✔ Building admin panel (39617ms)
2025-11-18T04:37:31.295576966Z │ INFO[0174] Taking snapshot of files...
2025-11-18T04:37:32.173863639Z │ INFO[0175] Pushing layer <registry-uri-5> to cache now
2025-11-18T04:37:32.173894262Z │ INFO[0175] Pushing image to <registry-uri-6>
2025-11-18T04:37:32.180484181Z │ INFO[0175] RUN npx tsc --project tsconfig.config.json
2025-11-18T04:37:33.235229791Z │ INFO[0176] Pushed <registry-uri-7>
2025-11-18T04:37:33.735343555Z │ INFO[0177] Cmd: /bin/sh
2025-11-18T04:37:33.735393779Z │ INFO[0177] Args: [-c npx tsc --project tsconfig.config.json]
2025-11-18T04:37:33.735404467Z │ INFO[0177] Running: [/bin/sh -c npx tsc --project tsconfig.config.json]
2025-11-18T04:37:38.432968587Z │ INFO[0181] Taking snapshot of files...
2025-11-18T04:37:38.865806221Z │ INFO[0182] Pushing layer <registry-uri-8> to cache now
2025-11-18T04:37:38.865853280Z │ INFO[0182] Pushing image to <registry-uri-9>
2025-11-18T04:37:39.622664257Z │ INFO[0182] Pushed <registry-uri-10>
2025-11-18T04:37:39.623385657Z │ INFO[0182] Saving file app/server.js for later use
2025-11-18T04:37:39.623730754Z │ INFO[0182] Saving file app/dist for later use
2025-11-18T04:37:39.674961706Z │ INFO[0183] Saving file app/public for later use
2025-11-18T04:37:39.675250622Z │ INFO[0183] Saving file app/node_modules for later use
2025-11-18T04:37:46.976464828Z │ INFO[0190] Saving file app/database for later use
2025-11-18T04:37:46.976850257Z │ INFO[0190] Saving file app/src for later use
2025-11-18T04:37:46.983696427Z │ INFO[0190] Saving file app/package-lock.json for later use
2025-11-18T04:37:46.984469145Z │ INFO[0190] Saving file app/package.json for later use
2025-11-18T04:37:46.984771643Z │ INFO[0190] Deleting filesystem...
2025-11-18T04:37:50.073259780Z │ INFO[0193] Retrieving image manifest node:22-alpine
2025-11-18T04:37:50.073581777Z │ INFO[0193] Returning cached image manifest
2025-11-18T04:37:50.073606377Z │ INFO[0193] Retrieving image manifest node:22-alpine
2025-11-18T04:37:50.073611470Z │ INFO[0193] Returning cached image manifest
2025-11-18T04:37:50.073615448Z │ INFO[0193] Executing 0 build triggers
2025-11-18T04:37:50.073946143Z │ INFO[0193] Building stage 'node:22-alpine' [idx: '1', base-idx: '-1']
2025-11-18T04:37:50.189022651Z │ error building image: error building stage: failed to optimize instructions: failed to get files used from context: failed to get fileinfo for /kaniko/0/app/config-dist: lstat /kaniko/0/app/config-dist: no such file or directory
2025-11-18T04:37:50.204125470Z │
2025-11-18T04:37:50.204151378Z │ command exited with code 1
2025-11-18T04:37:50.204925269Z │
2025-11-18T04:37:50.952229578Z │  ✘ build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment