Skip to content

Commit c69c6aa

Browse files
committed
fix: newline interpretation in docker_base make target
When executing docker-based Makefile targets the target `docker_base` executes a docker command with an inline Dockerfile piped to its input containing uninterpreted `\n` chars, causing a failure during parseing. To create multi-line inlined Dockerfiles the `-e` option must be used with `echo`, however to prevent incompatibility issues with other shells, like Ubuntu's dash, using `printf` is the best option. Closes #5340 Signed-off-by: Bruno Meneguele <bmeneg@heredoc.io>
1 parent 9097777 commit c69c6aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ docker_base:
203203
if [ "$${response}" = "200" ]; then \
204204
echo "Found base Dockerfile"; \
205205
curl -s "$(BASE_DOCKERFILE)" | docker build -t $(LOCAL_CACHE_IMAGE_BASE) -f - .; \
206-
echo "FROM $(LOCAL_CACHE_IMAGE_BASE)\nWORKDIR /edgex-go\nCOPY go.mod .\nRUN go mod download" | docker build -t $(LOCAL_CACHE_IMAGE) -f - .; \
206+
printf "FROM $(LOCAL_CACHE_IMAGE_BASE)\nWORKDIR /edgex-go\nCOPY go.mod .\nRUN go mod download" | docker build -t $(LOCAL_CACHE_IMAGE) -f - .; \
207207
else \
208208
echo "No base Dockerfile found. Using golang:$(GO_VERSION)-alpine"; \
209-
echo "FROM golang:$(GO_VERSION)-alpine\nRUN apk add --update make git\nWORKDIR /edgex-go\nCOPY go.mod .\nRUN go mod download" | docker build -t $(LOCAL_CACHE_IMAGE) -f - .; \
209+
printf "FROM golang:$(GO_VERSION)-alpine\nRUN apk add --update make git\nWORKDIR /edgex-go\nCOPY go.mod .\nRUN go mod download" | docker build -t $(LOCAL_CACHE_IMAGE) -f - .; \
210210
fi
211211

212212
dcore: dmetadata ddata dcommand

0 commit comments

Comments
 (0)