feat(builder): py_compile + node --check при сборке ловят синтаксические ошибки (v0.1.63)
This commit is contained in:
@@ -132,11 +132,17 @@ func generateDockerfile(runtime string, hasRequirements bool, hasPackageJSON boo
|
||||
if hasRequirements {
|
||||
content += "RUN pip install --no-cache-dir -r /app/function/requirements.txt\n"
|
||||
}
|
||||
// Проверяем синтаксис всех .py файлов на этапе сборки образа.
|
||||
// Если в коде синтаксическая ошибка — kaniko завершится с ошибкой и фаза = Failed.
|
||||
// Без этого шага образ собирается успешно, а под падает в CrashLoopBackOff при запуске.
|
||||
content += "RUN python -m py_compile $(find /app/function -name '*.py')\n"
|
||||
case "nodejs20":
|
||||
if hasPackageJSON {
|
||||
// cd нужен т.к. npm install читает package.json из текущей директории
|
||||
content += "RUN cd /app/function && npm install --omit=dev\n"
|
||||
}
|
||||
// Проверяем синтаксис всех .js файлов через node --check.
|
||||
content += "RUN find /app/function -name '*.js' | xargs -r node --check\n"
|
||||
}
|
||||
return []byte(content), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user