From a75daba0b9392a8197c459cf87779e8288cc79f3 Mon Sep 17 00:00:00 2001 From: leocavalcante Date: Thu, 9 May 2024 21:06:56 +0000 Subject: [PATCH 1/3] feat(devc): All supported versions --- .github/workflows/devcontainer.yml | 15 ++++++++++++++- Dockerfile | 4 +++- Makefile | 6 +++--- src-devc/.devcontainer/Dockerfile | 7 ++++++- src-devc/.devcontainer/devcontainer.json | 6 +++++- src-devc/build.sh | 3 +++ src/docker.sh | 2 +- 7 files changed, 35 insertions(+), 8 deletions(-) create mode 100755 src-devc/build.sh diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 943e480..61d9258 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -9,6 +9,16 @@ on: jobs: devcontainer: runs-on: ubuntu-latest + strategy: + matrix: + include: + - php: 81 + php-str: 8.1 + - php: 82 + php-str: 8.2 + - php: 83 + php-str: 8.3 + steps: - name: Checkout @@ -28,8 +38,11 @@ jobs: - name: Build and run dev container task uses: devcontainers/ci@v0.3 + env: + PHP_VERSION: ${{ matrix.php }} + PHP_VERSION_STR: ${{ matrix.php-str }} with: subFolder: src-devc imageName: opencodeco/phpctl - imageTag: php83-devcontainer + imageTag: php${{ matrix.php }}-devcontainer push: always diff --git a/Dockerfile b/Dockerfile index 2e07cf9..fb30549 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,12 +11,14 @@ ARG WITHOUT_WATCHR ENV WITHOUT_WATCHR=$WITHOUT_WATCHR COPY rootfs / -RUN apk add --update --no-cache \ +RUN apk update && apk upgrade && apk add --no-cache \ git \ docker-cli \ php${PHP}-cli \ php${PHP}-ctype \ + php${PHP}-curl \ php${PHP}-dom \ + php${PHP}-ffi \ php${PHP}-fileinfo \ php${PHP}-gd \ php${PHP}-iconv \ diff --git a/Makefile b/Makefile index 08d8486..5e81ec8 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,6 @@ test: install: @sudo ./scripts/symlink-bins.sh -.PHONY: devcontainer -devcontainer: - @devcontainer build --no-cache --workspace-folder devcontainer --push true --image-name opencodeco/phpctl:php83-devcontainer +.PHONY: devcontainers +devcontainers: + @parallel --line-buffer PHP_VERSION={} ./src-devc/build.sh ::: 81 82 83 diff --git a/src-devc/.devcontainer/Dockerfile b/src-devc/.devcontainer/Dockerfile index 371e09c..c07f286 100644 --- a/src-devc/.devcontainer/Dockerfile +++ b/src-devc/.devcontainer/Dockerfile @@ -1,4 +1,9 @@ -FROM php:8.3-cli-bookworm +ARG PHP_VERSION 83 +ARG PHP_VERSION_STR 8.3 + +FROM php:${PHP_VERSION_STR}-cli-bookworm +ENV PHP_VERSION $PHP_VERSION + ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ COPY rootfs . RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ diff --git a/src-devc/.devcontainer/devcontainer.json b/src-devc/.devcontainer/devcontainer.json index ad31c17..e2e63e9 100644 --- a/src-devc/.devcontainer/devcontainer.json +++ b/src-devc/.devcontainer/devcontainer.json @@ -1,7 +1,11 @@ { "build": { "dockerfile": "./Dockerfile", - "context": "../.." + "context": "../..", + "args": { + "PHP_VERSION": "${localEnv:PHP_VERSION}", + "PHP_VERSION_STR": "${localEnv:PHP_VERSION_STR}" + } }, "features": { "ghcr.io/devcontainers/features/common-utils:2": { diff --git a/src-devc/build.sh b/src-devc/build.sh new file mode 100755 index 0000000..40ba4c4 --- /dev/null +++ b/src-devc/build.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +export PHP_VERSION_STR="${PHP_VERSION:0:1}.${PHP_VERSION:1}" +devcontainer build --workspace-folder src-devc --push true --image-name "opencodeco/phpctl:php$PHP_VERSION-devcontainer" diff --git a/src/docker.sh b/src/docker.sh index 02ababc..f0d8711 100644 --- a/src/docker.sh +++ b/src/docker.sh @@ -54,7 +54,7 @@ run() { if [ -n "$GIT_EXEC_PATH" ]; then # In a Git hook environment, we need to disable TTY allocation PHPCTL_TTY="--label=no-tty" - fi + fi # shellcheck disable=SC2046 # shellcheck disable=SC2068 From d1b20109a9ea5009804cd520465d3007316be6a6 Mon Sep 17 00:00:00 2001 From: leocavalcante Date: Thu, 9 May 2024 18:14:11 -0300 Subject: [PATCH 2/3] chore(ci): Trigger From 2c11396d3d6e2126769101da12aa5027afd03a1d Mon Sep 17 00:00:00 2001 From: leocavalcante Date: Thu, 9 May 2024 21:24:43 +0000 Subject: [PATCH 3/3] fix(devc): Root file system and parallel --- src-devc/.devcontainer/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src-devc/.devcontainer/Dockerfile b/src-devc/.devcontainer/Dockerfile index fcc1406..c9bb6e8 100644 --- a/src-devc/.devcontainer/Dockerfile +++ b/src-devc/.devcontainer/Dockerfile @@ -1,12 +1,11 @@ ARG PHP_VERSION 83 ARG PHP_VERSION_STR 8.3 - FROM php:${PHP_VERSION_STR}-cli-bookworm ENV PHP_VERSION $PHP_VERSION - +COPY rootfs / ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends libcurl4-openssl-dev libc-ares-dev libsqlite3-dev libpq-dev git unzip wget \ + && apt-get -y install --no-install-recommends libcurl4-openssl-dev libc-ares-dev libsqlite3-dev libpq-dev git parallel unzip wget \ && mv /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini \ && mv /etc/php/php.ini /usr/local/etc/php/conf.d/zzphp.ini \ && install-php-extensions sockets && install-swoole && install-tools