Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command not being executed #24

Open
sneycampos opened this issue Aug 28, 2024 · 1 comment
Open

Command not being executed #24

sneycampos opened this issue Aug 28, 2024 · 1 comment

Comments

@sneycampos
Copy link

Hello, i'm trying to exec a command but it doesn't give me any output about the execution.

I'd try exec php -v or exec php artisan about and the output is the same.

Executing these commands inside the container runs normally.

Caddyfile:

{
	{$CADDY_GLOBAL_OPTIONS}

	frankenphp {
		{$FRANKENPHP_CONFIG}
	}

	order php_server before file_server
	order php before file_server

	exec php artisan optimize
}

{$CADDY_EXTRA_CONFIG}

{$SERVER_NAME:localhost} {
	root * public/
	encode zstd br gzip

	{$CADDY_SERVER_EXTRA_DIRECTIVES}

	php_server
}

Output:

frankenphp-1  | {"level":"info","ts":1724843562.6514235,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
frankenphp-1  | {"level":"info","ts":1724843562.6519766,"msg":"adapted config to JSON","adapter":"caddyfile"}
frankenphp-1  | {"level":"warn","ts":1724843562.6519816,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":14}
frankenphp-1  | {"level":"info","ts":1724843562.652385,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
frankenphp-1  | {"level":"warn","ts":1724843562.6524725,"logger":"http.auto_https","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
frankenphp-1  | {"level":"info","ts":1724843562.6525922,"msg":"FrankenPHP started 🐘","php_version":"8.3.7"}
frankenphp-1  | {"level":"info","ts":1724843562.652677,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
frankenphp-1  | {"level":"info","ts":1724843562.6525931,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x40000e3100"}
frankenphp-1  | {"level":"info","ts":1724843562.652971,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
frankenphp-1  | {"level":"info","ts":1724843562.6529841,"msg":"serving initial configuration"}
frankenphp-1  | {"level":"info","ts":1724843562.6540203,"logger":"tls","msg":"cleaning storage unit","storage":"FileStorage:/data/caddy"}
frankenphp-1  | {"level":"info","ts":1724843562.6541,"logger":"tls","msg":"finished cleaning storage units"}
frankenphp-1  | {"level":"info","ts":1724843562.667389,"logger":"exec.exit","msg":"","command":["php"],"duration":0.014693252}

Running the command inside in the container
image

I do build frankenphp using the following dockerfile part:

FROM dunglas/frankenphp:latest-builder AS builder

# Copy xcaddy in the builder image
COPY --from=caddy:builder /usr/bin/xcaddy /usr/bin/xcaddy

# CGO must be enabled to build FrankenPHP
ENV CGO_ENABLED=1 XCADDY_SETCAP=1 XCADDY_GO_BUILD_FLAGS="-ldflags '-w -s'"
RUN xcaddy build \
	--output /usr/local/bin/frankenphp \
	--with github.com/dunglas/frankenphp=./ \
	--with github.com/dunglas/frankenphp/caddy=./caddy/ \
    --with github.com/dunglas/caddy-cbrotli \
    --with github.com/abiosoft/caddy-exec

FROM dunglas/frankenphp:1.2.5-php8.3.10-bookworm as runner

COPY --from=builder /usr/local/bin/frankenphp /usr/local/bin/frankenphp
COPY Caddyfile /etc/caddy/Caddyfile
@PascaleBeier
Copy link

See #23.

I pinned caddy-exec to 46a1d88

 --with github.com/abiosoft/caddy-exec@46a1d88 

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

No branches or pull requests

2 participants