Skip to content

Update docker image due to missing/depracated dependencies#4190

Merged
antonmedv merged 1 commit intodeployphp:masterfrom
featdd:master
Apr 12, 2026
Merged

Update docker image due to missing/depracated dependencies#4190
antonmedv merged 1 commit intodeployphp:masterfrom
featdd:master

Conversation

@featdd
Copy link
Copy Markdown
Contributor

@featdd featdd commented Apr 12, 2026

The current docker image fails because of the missing sockets extension for PHP.

For successfull build and execution "linux-headers" & "curl-dev" needed to be added.

I build a custom image for v8.0.0-rc, see featdd/deployerphp:v8.0.0-rc and now it works fine for me.

Dockerfile Outdated
@@ -1,8 +1,8 @@
FROM php:8.4-cli-alpine
FROM php:8.5-cli-alpine
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets split to a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed this and amended this to the pull request commit

@antonmedv
Copy link
Copy Markdown
Member

Why do we need "linux-headers" & "curl-dev"?

@featdd
Copy link
Copy Markdown
Contributor Author

featdd commented Apr 12, 2026

Hi @antonmedv,

linux-headers

The "linux-headers" is necessary to compile the socket extension for PHP, otherwise the docker build ends up with this error:
`cc -I. -I/usr/src/php/ext/sockets -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/sockets/sockets.c -MMD -MF sockets.dep -MT sockets.lo -fPIC -DPIC -o .libs/sockets.o

/usr/src/php/ext/sockets/sockets.c:58:12: fatal error: linux/sock_diag.h: No such file or directory`

The file necessary is part of the linux-header package, see: linux/sock_diag.h

curl-dev

Similiar issue happens when you try to compile the curl PHP extension (Package 'libcurl' not found), it requires libcurl which is installed through "curl-dev" (It's kind of an equivalent for alpine linux)

mbstring

This can be dropped as the extension is enabled by default in the base image already

mcrypt

The extension is deprecated and shouldn't be used anymore, it fails to be installed with pecl or docker-php-ext-install, by searching the code I didn't see a hard dependency on this anyway or did I oversee something here?
Error: error: /usr/src/php/ext/mcrypt does not exist

PHP 8.5

Should I just drop/amend this from this commit? (It works fine in the image I built)

Greetings
Daniel

@antonmedv antonmedv merged commit 7e25232 into deployphp:master Apr 12, 2026
11 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the project’s Docker image build to resolve missing/deprecated dependencies so the published Deployer container can build and run successfully again.

Changes:

  • Adds Alpine packages needed to compile required PHP extensions (linux-headers, curl-dev).
  • Updates the installed PHP extensions list to ensure sockets (and others) are built into the image.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +5
RUN apk update && apk add --no-cache linux-headers bash git openssh-client rsync zip unzip libzip-dev curl-dev

RUN docker-php-ext-install mbstring mcrypt pcntl sockets curl zip
RUN docker-php-ext-install pcntl sockets curl zip
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@featdd looks like --no-cache is enought. Could you please verify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@antonmedv ah not only that, it seems curl is also already available by default.

I just let codex do some further optimizations and could save 13MB in the final image, see: featdd/deployerphp

I'll create another pull request

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.

3 participants