From ca93692e463d9deac010a50efc704b52802e22ef Mon Sep 17 00:00:00 2001 From: BigBadBassMan Date: Tue, 24 Sep 2024 09:43:40 +0200 Subject: [PATCH] update and cleanup PHP8.2 images --- .docker/Dockerfile | 12 ------------ .docker/build | 4 ++-- .docker/dockerhub.dockerfile | 14 ++++++++++++++ .docker/php82 | 7 ------- .docker/php82.dockerfile | 25 +++++++++++++++++++++++++ .docker/php82_build_phar | 19 ------------------- .docker/php82_xdebug | 9 --------- .docker/php82_xdebug.dockerfile | 25 +++++++++++++++++++++++++ .github/workflows/docker.yaml | 4 ++-- .github/workflows/release.yaml | 2 +- 10 files changed, 69 insertions(+), 52 deletions(-) delete mode 100644 .docker/Dockerfile create mode 100644 .docker/dockerhub.dockerfile delete mode 100644 .docker/php82 create mode 100644 .docker/php82.dockerfile delete mode 100644 .docker/php82_build_phar delete mode 100644 .docker/php82_xdebug create mode 100644 .docker/php82_xdebug.dockerfile diff --git a/.docker/Dockerfile b/.docker/Dockerfile deleted file mode 100644 index 2ab222999..000000000 --- a/.docker/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM php:8.2-cli-alpine - -# hadolint ignore=DL3022 -COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ -RUN install-php-extensions zlib phar sodium tokenizer filter - -# hadolint ignore=DL3022 -COPY --chmod=755 --from=composer/composer:2-bin /composer /usr/bin/composer - -COPY bin/box.phar /box.phar - -ENTRYPOINT ["/box.phar"] diff --git a/.docker/build b/.docker/build index 2e45cedf5..304a5f24b 100755 --- a/.docker/build +++ b/.docker/build @@ -5,9 +5,9 @@ set -euf -o pipefail readonly SCRIPT_DIR=$(dirname $(realpath "${BASH_SOURCE:-$0}")) if [[ "$(docker images -q ghcr.io/box-project/box_php82 2> /dev/null)" == "" ]]; then - docker build --platform=linux/amd64 --tag=ghcr.io/box-project/box_php82 --file "${SCRIPT_DIR}/php82" . + docker build --platform=linux/amd64 --tag=ghcr.io/box-project/box_php82 --file "${SCRIPT_DIR}/php82.dockerfile" . fi if [[ "$(docker images -q ghcr.io/box-project/box_php82_xdebug 2> /dev/null)" == "" ]]; then - docker build --platform=linux/amd64 --tag=ghcr.io/box-project/box_php82_xdebug --file "${SCRIPT_DIR}/php82_xdebug" . + docker build --platform=linux/amd64 --tag=ghcr.io/box-project/box_php82_xdebug --file "${SCRIPT_DIR}/php82_xdebug.dockerfile" . fi diff --git a/.docker/dockerhub.dockerfile b/.docker/dockerhub.dockerfile new file mode 100644 index 000000000..e0e2e2efc --- /dev/null +++ b/.docker/dockerhub.dockerfile @@ -0,0 +1,14 @@ +FROM --platform=linux/amd64 php:8.2-cli-alpine + +# hadolint ignore=DL3022 +COPY --chmod=755 --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ +RUN install-php-extensions zlib phar sodium tokenizer filter + +# hadolint ignore=DL3022 +COPY --chmod=755 --from=composer/composer:2-bin /composer /usr/bin/composer + +COPY --chmod=755 bin/box.phar /box.phar + +RUN mkdir -p /local +WORKDIR /local +ENTRYPOINT ["/box.phar"] diff --git a/.docker/php82 b/.docker/php82 deleted file mode 100644 index 5e9d61ec3..000000000 --- a/.docker/php82 +++ /dev/null @@ -1,7 +0,0 @@ -FROM php:8.2-cli - -RUN echo '' | \ - apt-get -y update; \ - apt-get install -y --no-install-recommends libicu-dev; \ - docker-php-ext-configure intl; \ - docker-php-ext-install intl; diff --git a/.docker/php82.dockerfile b/.docker/php82.dockerfile new file mode 100644 index 000000000..5f41ff826 --- /dev/null +++ b/.docker/php82.dockerfile @@ -0,0 +1,25 @@ +FROM --platform=linux/amd64 php:8.2-cli-alpine AS build-stage + +RUN apk add --update make git + +# hadolint ignore=DL3022 +COPY --chmod=755 --from=composer/composer:2-bin /composer /usr/bin/composer + +RUN mkdir -p /opt/box-project/box +WORKDIR /opt/box-project/box +ADD . /opt/box-project/box +RUN make compile + +FROM --platform=linux/amd64 php:8.2-cli-alpine + +# hadolint ignore=DL3022 +COPY --chmod=755 --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ +RUN install-php-extensions zlib phar sodium tokenizer filter intl + +COPY --chmod=755 --from=build-stage /opt/box-project/box/bin/box.phar /usr/bin/box +# hadolint ignore=DL3022 +COPY --chmod=755 --from=composer/composer:2-bin /composer /usr/bin/composer + +RUN mkdir -p /local +WORKDIR /local +ENTRYPOINT ["/usr/bin/box"] diff --git a/.docker/php82_build_phar b/.docker/php82_build_phar deleted file mode 100644 index e5cd65ee1..000000000 --- a/.docker/php82_build_phar +++ /dev/null @@ -1,19 +0,0 @@ -FROM php:8.2-cli-alpine as build-stage - -RUN apk add --update make git - -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer - -RUN mkdir -p /opt/box-project/box -WORKDIR /opt/box-project/box -ADD . /opt/box-project/box -RUN cd /opt/box-project/box && \ - make compile - -FROM php:8.2-cli-alpine - -COPY --from=build-stage /opt/box-project/box/bin/box.phar /usr/bin/box - -RUN mkdir -p /local -WORKDIR /local -ENTRYPOINT ["/usr/bin/box"] \ No newline at end of file diff --git a/.docker/php82_xdebug b/.docker/php82_xdebug deleted file mode 100644 index ca34eab1b..000000000 --- a/.docker/php82_xdebug +++ /dev/null @@ -1,9 +0,0 @@ -FROM php:8.2-cli - -RUN echo '' | \ - apt-get -y update; \ - apt-get install -y --no-install-recommends libicu-dev; \ - docker-php-ext-configure intl; \ - docker-php-ext-install intl; \ - pecl install xdebug; \ - docker-php-ext-enable xdebug; diff --git a/.docker/php82_xdebug.dockerfile b/.docker/php82_xdebug.dockerfile new file mode 100644 index 000000000..0d11dd424 --- /dev/null +++ b/.docker/php82_xdebug.dockerfile @@ -0,0 +1,25 @@ +FROM --platform=linux/amd64 php:8.2-cli-alpine as build-stage + +RUN apk add --update make git + +# hadolint ignore=DL3022 +COPY --chmod=755 --from=composer/composer:2-bin /composer /usr/bin/composer + +RUN mkdir -p /opt/box-project/box +WORKDIR /opt/box-project/box +ADD . /opt/box-project/box +RUN make compile + +FROM --platform=linux/amd64 php:8.2-cli-alpine + +# hadolint ignore=DL3022 +COPY --chmod=755 --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ +RUN install-php-extensions zlib phar sodium tokenizer filter intl xdebug + +COPY --chmod=755 --from=build-stage /opt/box-project/box/bin/box.phar /usr/bin/box +# hadolint ignore=DL3022 +COPY --chmod=755 --from=composer/composer:2-bin /composer /usr/bin/composer + +RUN mkdir -p /local +WORKDIR /local +ENTRYPOINT ["/usr/bin/box"] diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index dbdf31f92..9bed22532 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -33,10 +33,10 @@ jobs: matrix: include: - name: PHP 8.2 - docker-file: .docker/php82 + docker-file: .docker/php82.dockerfile image-tag: ghcr.io/box-project/box_php82 - name: PHP 8.2 (Xdebug) - docker-file: .docker/php82_xdebug + docker-file: .docker/php82_xdebug.dockerfile image-tag: ghcr.io/box-project/box_php82_xdebug steps: - name: Checkout diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 744f0a500..5553b876e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,7 @@ concurrency: cancel-in-progress: true env: - DOCKERFILE: .docker/Dockerfile + DOCKERFILE: .docker/dockerhub.dockerfile DOCKERHUB_USERNAME: boxproject TERM: xterm