Skip to content

[LP-492] Make lockfiles optional and improve build flexibility#6

Merged
yessjun merged 2 commits intomainfrom
feat/LP-492-remove-template-validation
Nov 14, 2025
Merged

[LP-492] Make lockfiles optional and improve build flexibility#6
yessjun merged 2 commits intomainfrom
feat/LP-492-remove-template-validation

Conversation

@yessjun
Copy link
Contributor

@yessjun yessjun commented Nov 14, 2025

Summary

  • 모든 package manager에서 lockfile 없이도 빌드 가능하도록 개선
  • 빌드 실패를 일으킬 수 있는 잠재적 문제 5개 해결
  • 데이터베이스 템플릿 UX 개선으로 사용자 혼란 제거
  • 15개 템플릿에서 총 73줄 추가, 77줄 삭제로 안정성 및 사용성 향상

Changes

Part 1: Lockfile Optional 처리 (10개 애플리케이션 템플릿)

npm (React, Next.js, Vue.js, Express.js, NestJS)

  • npm cinpm install --no-audit --prefer-offline로 변경
  • package-lock.json 없이도 빌드 가능
  • 보안 감사 생략으로 빌드 속도 향상
  • 오프라인 캐시 우선 사용

yarn (React, Next.js, Vue.js, Express.js, NestJS)

  • COPY yarn.lock ./COPY yarn.lock* ./로 wildcard 추가
  • --frozen-lockfile 플래그 제거
  • lockfile 있으면 사용, 없으면 자동 생성

pnpm (React, Next.js, Vue.js, Express.js, NestJS)

  • COPY pnpm-lock.yaml ./COPY pnpm-lock.yaml* ./로 wildcard 추가
  • --frozen-lockfile 플래그 제거
  • lockfile 있으면 사용, 없으면 자동 생성

pipenv (Django, FastAPI, Flask)

  • COPY Pipfile.lock ./COPY Pipfile.lock* ./로 wildcard 추가
  • --deploy 플래그 제거
  • Pipfile.lock 없이도 빌드 가능

poetry (Django, FastAPI, Flask)

  • 이미 poetry.lock* wildcard 사용 중 (변경 없음)

gradle (Spring Boot, Kotlin Spring Boot)

  • COPY settings.gradle.kts ./COPY settings.gradle.kts* ./로 wildcard 추가
  • 단일 모듈 Gradle 프로젝트에서 settings 파일 없이도 빌드 가능

Part 2: 빌드 안정성 개선 (5개 애플리케이션 템플릿)

Next.js

  • 문제: public 디렉토리가 없는 프로젝트에서 COPY 실패
  • 해결: RUN mkdir -p public 추가로 빈 디렉토리 생성

Spring Boot & Kotlin Spring Boot

  • 문제: plain.jar와 실행 가능한 JAR이 혼재 시 잘못된 파일 복사 가능
  • 해결: RUN cp $(find build/libs -name "*[!n].jar" -type f | head -n 1) app.jar 2>/dev/null || cp build/libs/*.jar app.jar
  • plain.jar 제외 패턴 우선, 실패 시 모든 JAR 복사

Django & FastAPI

  • 문제: Python 버전 경로 매칭 이슈 (예: python3.11 vs python3.12)
  • 해결: /usr/local/lib/python{{ .python_version }}/site-packages/usr/local/lib 전체 복사
  • poetry와 pipenv 조건 통합으로 코드 중복 제거

Part 3: 데이터베이스 템플릿 UX 개선 (4개 DB 템플릿)

레이블 중복 제거 (12개 필드)

  • 문제: 이미 category: "optional"로 표시되는데 레이블에도 " (선택사항)" 포함
  • 해결: 모든 " (선택사항)" 레이블 제거
    • MongoDB: 5개 (데이터베이스명, Root 사용자명, Root 비밀번호, 애플리케이션 사용자명, 애플리케이션 비밀번호)
    • MySQL: 3개 (Root 비밀번호, 애플리케이션 사용자명, 애플리케이션 비밀번호)
    • PostgreSQL: 3개 (사용자명, 비밀번호, PostgreSQL Root 비밀번호)
    • Redis: 1개 (Redis 비밀번호)

플레이스홀더 제거 (2개 필드)

  • 문제: database_name 기본값이 "myapp"으로 설정되어 사용자 혼란 유발
  • 해결: MySQL, PostgreSQL의 database_name default를 빈 문자열로 변경

SQL 비밀번호 필수화 (2개 템플릿)

  • 문제: MySQL, PostgreSQL은 비밀번호 없이 접속 불가능한데 optional로 설정됨
  • 해결: root_password를 required로 변경하고 필드 순서 재정렬
    • MySQL: root_password를 charset 다음으로 이동
    • PostgreSQL: postgres_password를 version 다음으로 이동

@yessjun yessjun force-pushed the feat/LP-492-remove-template-validation branch from 6b785d2 to fc620ea Compare November 14, 2025 05:30
@yessjun yessjun changed the title [LP-492] Replace npm ci with npm install for flexible dependency resolution [LP-492] Make lockfiles optional for all package managers Nov 14, 2025
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 5 to +10
{{ if eq .package_manager "npm" }}
COPY package*.json ./
{{ else if eq .package_manager "yarn" }}
COPY package.json yarn.lock ./
COPY package.json yarn.lock* ./
{{ else }}
COPY package.json pnpm-lock.yaml ./
COPY package.json pnpm-lock.yaml* ./

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make yarn/pnpm lockfiles truly optional

COPY package.json yarn.lock* ./ still fails when yarn.lock is absent because Docker requires every COPY source to resolve to at least one file; an unmatched glob raises no source files were specified. As a result, Yarn (and pnpm) templates will continue to fail to build when no lockfile is supplied despite relaxing the install commands. Consider splitting the copy into two commands or using a pattern that always matches (e.g. package*.json) so lockfiles are genuinely optional across all affected templates (Express, NestJS, React, Next.js, Vue).

Useful? React with 👍 / 👎.

@yessjun yessjun force-pushed the feat/LP-492-remove-template-validation branch 2 times, most recently from d5611f9 to b037b56 Compare November 14, 2025 05:59
@yessjun yessjun changed the title [LP-492] Make lockfiles optional for all package managers [LP-492] Make lockfiles optional and improve build flexibility Nov 14, 2025
@yessjun yessjun self-assigned this Nov 14, 2025
@yessjun yessjun requested a review from ikjeong November 14, 2025 06:05
**Lockfile Changes:**
- npm: Replace 'npm ci' with 'npm install --no-audit --prefer-offline'
- yarn: Use 'yarn.lock*' wildcard and remove '--frozen-lockfile'
- pnpm: Use 'pnpm-lock.yaml*' wildcard and remove '--frozen-lockfile'
- pipenv: Remove '--deploy' flag to allow builds without Pipfile.lock
- gradle: Use 'settings.gradle.kts*' wildcard for single-module projects

**Build Robustness Improvements:**
- Next.js: Ensure public directory exists in builder stage
- Spring Boot: Improve JAR file selection logic with fallback
- Kotlin Spring Boot: Improve JAR file selection logic with fallback
- Django/FastAPI: Simplify Python package copying to avoid version mismatch

Allow builds without lockfiles for maximum flexibility while
still using lockfiles when available for reproducible builds.

Affected templates:
- Frontend: React, Next.js, Vue.js
- Backend Node.js: Express.js, NestJS
- Backend Python: Django, FastAPI, Flask
- Backend JVM: Spring Boot, Kotlin Spring Boot

LP-492
@yessjun yessjun force-pushed the feat/LP-492-remove-template-validation branch from b037b56 to 111cf49 Compare November 14, 2025 06:25
- Remove redundant "(선택사항)" labels (already shown by category)
- Remove confusing "myapp" placeholder from database_name defaults
- Make SQL root passwords required (MySQL, PostgreSQL)
- Add fallback values for PostgreSQL ENV variables
- Reorder required fields for better UX

LP-492
@yessjun yessjun merged commit 05d54dd into main Nov 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant