잘못된 정의 설명 주석
잘못된 정의 설명 주석 (InvalidDefinitionDescription)
빌드 체크 규칙 중 하나로, 빌드 스테이지나 인자의 설명 주석 형식이 잘못된 경우를 알려줘요. --call=outline과 --call=targets 플래그가 이 주석에서 설명을 만들어 내기 때문이에요. 이 체크는 실험적이라 기본적으로 활성화되지 않습니다.
출처: 문서
본문
이 체크는 실험적이며 기본적으로 활성화되지 않아요. 활성화하려면 실험적 체크를 참고하세요.
docker build 명령의 --call=outline과 --call=targets 플래그는 빌드 대상과 인자에 대한 설명을 출력해요. 설명은 FROM이나 ARG 지시어 바로 앞에 있고, 빌드 스테이지나 인자의 이름으로 시작하는 Dockerfile 주석에서 생성됩니다. 예를 들어:
# build-cli builds the CLI binary
FROM alpine AS build-cli
# VERSION controls the version of the program
ARG VERSION=1
앞의 주석이 설명을 위한 것이 아닌 경우에는 지시어와 앞 주석 사이에 빈 줄이나 주석을 추가하면 됩니다.
출력 메시지
Comment for build stage or argument should follow the format: `# <arg/stage name> <description>`. If this is not intended to be a description comment, add an empty line or comment between the instruction and the comment.
예시
❌ 나쁜 예: FROM 앞 줄에 설명이 아닌 주석이 있어요.
# a non-descriptive comment
FROM scratch AS base
# another non-descriptive comment
ARG VERSION=1
✅ 좋은 예: 설명이 아닌 주석 사이에 빈 줄을 넣어요.
# a non-descriptive comment
FROM scratch AS base
# another non-descriptive comment
ARG VERSION=1
✅ 좋은 예: 명령 바로 앞에 ARG 키와 스테이지를 설명하는 주석이 있어요.
# base is a stage for compiling source
FROM scratch AS base
# VERSION This is the version number.
ARG VERSION=1
더 알아보기
- 빌드 체크 개요: 기타 빌드 체크 규칙을 살펴봐요.
- 실험적 체크 관련 규칙: 실험적 체크 활성화 방법을 확인해요.