diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index dd39430..8b068cc 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -55,6 +55,28 @@ jobs: sbom: false tags: | ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:amd64 + build-amd64-image-with-utils: + runs-on: ubuntu-latest + env: + TZ: Asia/Shanghai + steps: + - uses: actions/checkout@v3 + - name: Login + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build && Push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + file: ./Dockerfile_with_utils + push: true + provenance: false + sbom: false + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:amd64-with-utils combine-two-images: runs-on: ubuntu-latest needs: diff --git a/Dockerfile_with_utils b/Dockerfile_with_utils new file mode 100644 index 0000000..ff0e523 --- /dev/null +++ b/Dockerfile_with_utils @@ -0,0 +1,82 @@ +# 使用 PHP 官方镜像作为基础 +FROM phpswoole/swoole:php8.3 +#FROM phpswoole/swoole:5.1.2-php8.3 +#FROM php:8.3-cli + + +# 设置非交互式前端以避免交互式配置 +ENV DEBIAN_FRONTEND=noninteractive + + +RUN apt-get update && apt-get install -y \ + libfreetype-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + && rm -r /var/lib/apt/lists/* \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) gd + +RUN apt-get update \ + && apt-get install -y \ + libc-client-dev \ + libkrb5-dev \ + && rm -r /var/lib/apt/lists/* \ + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ + && docker-php-ext-install imap + +RUN apt-get update \ + && apt-get install -y \ + libgmp-dev \ + && rm -r /var/lib/apt/lists/* \ + && docker-php-ext-install gmp + +RUN apt-get update \ + && apt-get install -y \ + zip \ + libzip-dev \ + && rm -r /var/lib/apt/lists/* \ + && docker-php-ext-install zip + +RUN apt-get update \ + && apt-get install -y \ + libxml2-dev \ + && rm -r /var/lib/apt/lists/* \ + && docker-php-ext-install soap + +#RUN apt-get update \ +# && apt-get install -y \ +# libmagickwand-dev \ +# && rm -r /var/lib/apt/lists/* \ +# && echo | pecl install imagick \ +# && docker-php-ext-enable imagick + + +RUN docker-php-ext-install pdo pgsql bcmath intl + +RUN pecl install msgpack \ + && pecl install igbinary \ + && pecl install pcov \ + && echo | pecl install mongodb \ + && docker-php-ext-enable msgpack igbinary pcov mongodb + +# 配置并启用 PCNTL 扩展 +RUN docker-php-ext-configure pcntl --enable-pcntl \ + && docker-php-ext-install pcntl + +COPY ./php.ini $PHP_INI_DIR/conf.d/docker-vars.ini + + +# 调试工具 +RUN apt-get update && apt-get install -y \ + vim \ + net-tools \ + iputils-ping \ + telnet \ + wget \ + dnsutils \ + postgresql-client \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# 定义容器启动时执行的命令 +CMD ["php", "--version"]