Skip to content

Commit 2421c64

Browse files
authored
build base image from debian (#1662)
1 parent dc52549 commit 2421c64

File tree

2 files changed

+42
-41
lines changed

2 files changed

+42
-41
lines changed

.github/workflows/publish-otel-php-base-docker-image.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: OpenTelemetry PHP base docker image creation
1919
strategy:
2020
matrix:
21-
php-version: ['8.0', '8.1', '8.2', '8.3', '8.4']
21+
php-version: ['8.1', '8.2', '8.3', '8.4']
2222
runs-on: ubuntu-latest
2323
permissions:
2424
packages: write
@@ -47,7 +47,6 @@ jobs:
4747
file: docker/Dockerfile
4848
build-args: PHP_VERSION=${{ matrix.php-version }}
4949
platforms: linux/amd64,linux/arm/v8,linux/arm64
50-
tags: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${{ matrix.php-version }}
5150

5251
- name: Build and push ${{ matrix.php-version }} to ghcr.io
5352
uses: docker/build-push-action@v6

docker/Dockerfile

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
1-
ARG PHP_VERSION=8.0
2-
3-
FROM php:8.0.30-cli-alpine AS php-8.0-cli-alpine
4-
FROM php:8.1.32-cli-alpine AS php-8.1-cli-alpine
5-
FROM php:8.2.28-cli-alpine AS php-8.2-cli-alpine
6-
FROM php:8.3.20-cli-alpine AS php-8.3-cli-alpine
7-
FROM php:8.4.8-cli-alpine AS php-8.4-cli-alpine
8-
9-
FROM php-${PHP_VERSION}-cli-alpine
10-
11-
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
12-
13-
RUN chmod +x /usr/local/bin/install-php-extensions \
14-
&& apk add binutils \
15-
&& install-php-extensions \
16-
@composer \
17-
ast \
18-
grpc \
19-
intl\
20-
opcache \
21-
opentelemetry \
22-
pcntl \
23-
protobuf \
24-
sockets \
25-
xdebug \
26-
zip \
27-
&& find /usr/local/lib/php/extensions -name "*.so" -exec strip --strip-debug {} \;
28-
29-
RUN echo "grpc.enable_fork_support = 1" > $(php-config --ini-dir)/grpc.ini \
30-
&& echo "grpc.poll_strategy = epoll1" >> $(php-config --ini-dir)/grpc.ini
31-
1+
FROM composer:2 AS composer
2+
FROM debian:bullseye
323
WORKDIR /usr/src/myapp
334

34-
RUN apk add --no-cache bash git; \
35-
find /usr/local/lib/php/extensions -type d -exec chmod +x -R {} \;; \
36-
addgroup -g "1000" -S php; \
37-
adduser --system \
38-
--gecos "" \
39-
--ingroup "php" \
40-
--uid "1000" \
41-
"php";
5+
RUN apt-get update \
6+
&& apt-get install -y --no-install-recommends git wget gnupg2 \
7+
&& rm -rf /var/lib/apt/lists/* \
8+
&& groupadd --gid 1000 php \
9+
&& useradd --system --uid 1000 --gid php --shell /bin/bash --create-home php
10+
11+
RUN apt-get update && apt-get install -y lsb-release apt-transport-https ca-certificates \
12+
&& echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list \
13+
&& wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - \
14+
&& apt-get update
15+
16+
ARG PHP_VERSION=8.3
17+
18+
RUN apt-get install -y \
19+
php${PHP_VERSION}-ast \
20+
php${PHP_VERSION}-cli \
21+
php${PHP_VERSION}-curl \
22+
php${PHP_VERSION}-dev \
23+
php${PHP_VERSION}-grpc \
24+
php${PHP_VERSION}-intl \
25+
php${PHP_VERSION}-mbstring \
26+
php${PHP_VERSION}-opcache \
27+
php${PHP_VERSION}-opentelemetry \
28+
php${PHP_VERSION}-protobuf \
29+
php${PHP_VERSION}-simplexml \
30+
php${PHP_VERSION}-sockets \
31+
php${PHP_VERSION}-xdebug \
32+
php${PHP_VERSION}-zip \
33+
php${PHP_VERSION}-mongodb \
34+
php${PHP_VERSION}-amqp \
35+
php${PHP_VERSION}-rdkafka \
36+
php${PHP_VERSION}-mysqli \
37+
unzip
38+
39+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
40+
41+
RUN echo ";grpc.enable_fork_support = 1" > $(php-config --ini-dir)/40-otel-dev.ini \
42+
&& echo "grpc.poll_strategy = epoll1" >> $(php-config --ini-dir)/40-otel-dev.ini \
43+
&& echo "zend.assertions = 1" >> $(php-config --ini-dir)/40-otel-dev.ini
4244

4345
USER php

0 commit comments

Comments
 (0)