api-platform: Caddy does not build

API Platform version(s) affected: 2.6.8

Description
Caddy does not build

2022/06/07 08:14:29 [FATAL] exit status 2
[568] Service 'caddy' failed to build : The command '/bin/sh -c xcaddy build     --with github.com/dunglas/mercure     --with github.com/dunglas/mercure/caddy     --with github.com/dunglas/vulcain     --with github.com/dunglas/vulcain/caddy' returned a non-zero code: 1

[569]
Cleaning up project directory and file based variables
00:01
[570] ERROR: Job failed: exit status 1

How to reproduce
Build API platform

Additional Context
Gitlab CI/CD

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Same today but with mercure instead

Capture d’écran du 2022-09-07 09-32-25

I had to change CADDY_VERSION to 2.5.2 in place of 2.5.1. CADDY_VERSION=2 didn’t work for me.

Same today with a fresh clone, while building with --no-cache. Updating caddy version as suggested by @icfmp did the trick:

diff --git a/api/Dockerfile b/api/Dockerfile
index 49452a7..4b8cc49 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -121,7 +121,7 @@ RUN set -eux; \
 RUN rm -f .env.local.php
 
 # Build Caddy with the Mercure and Vulcain modules
-FROM caddy:2-builder-alpine AS app_caddy_builder
+FROM caddy:2.5.2-builder-alpine AS app_caddy_builder
 
 RUN xcaddy build \
        --with github.com/dunglas/mercure \
@@ -130,7 +130,7 @@ RUN xcaddy build \
        --with github.com/dunglas/vulcain/caddy
 
 # Caddy image
-FROM caddy:2-alpine AS app_caddy
+FROM caddy:2.5.2-alpine AS app_caddy
 
 WORKDIR /srv/app

Just had the same problem with a fresh install.

docker pull caddy:2-builder-alpine 
docker pull caddy:2-alpine 

before docker compose build --pull --no-cache worked for me without changing any code.

I don’t understand why the --pull --no-cache had no effect on inherited images, though.