File tree 10 files changed +66
-18
lines changed
10 files changed +66
-18
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"image" : " opencodeco/phpctl:php83-devcontainer" ,
3
+ "containerEnv" : {
4
+ "PHP_VERSION" : " 83"
5
+ },
3
6
"features" : {
4
7
"ghcr.io/devcontainers/features/docker-in-docker:2" : {},
5
8
"ghcr.io/devcontainers-contrib/features/devcontainers-cli:1" : {},
6
- "ghcr.io/devcontainers/features/sshd:1" : {}
7
- },
8
- "customizations" : {
9
- "vscode" : {
10
- "extensions" : [
11
- " ms-vscode.makefile-tools" ,
12
- " ms-azuretools.vscode-docker" ,
13
- " timonwong.shellcheck"
14
- ]
9
+ "ghcr.io/devcontainers/features/sshd:1" : {},
10
+ "ghcr.io/devcontainers-contrib/features/apt-get-packages:1" : {
11
+ "packages" : " parallel"
15
12
}
16
13
}
17
14
}
Original file line number Diff line number Diff line change 8
8
.PHONY : test
9
9
test :
10
10
@parallel --line-buffer PHP_VERSION={} COMPOSER_AUTH= TERM= ./bin/notty ./lib/bashunit ./tests/ ::: 81 82 83
11
+ @[ -f phpctl.ini ] && rm phpctl.ini
11
12
12
13
.PHONY : install
13
14
install :
Original file line number Diff line number Diff line change 7
7
<h1>
8
8
phpctl
9
9
<a href="https://github.com/opencodeco/phpctl/actions/workflows/docker.yml"><img alt="phpctl docker badge" src="https://github.com/opencodeco/phpctl/actions/workflows/docker.yml/badge.svg"></a>
10
+ <a href="https://github.com/opencodeco/phpctl/actions/workflows/devcontainer.yml"><img alt="phpctl docker badge" src="https://github.com/opencodeco/phpctl/actions/workflows/devcontainer.yml/badge.svg"></a>
10
11
<a href="https://github.com/opencodeco/phpctl/actions/workflows/frankenphp.yml"><img alt="phpctl frankenphp badge" src="https://github.com/opencodeco/phpctl/actions/workflows/frankenphp.yml/badge.svg"></a>
11
12
</h1>
12
13
<p>🐳 A Docker-based development environment for PHP 🐘</p>
13
14
<blockquote>Heavily inspired by <a href="https://github.com/opencodeco/hfctl">opencodeco/hfctl</a>.</blockquote>
15
+ <p><a href="https://codespaces.new/opencodeco/phpctl?machine=standardLinux32gb"><img alt="Open in GitHub Codespaces" src="https://github.com/codespaces/badge.svg"></a></p>
14
16
</td>
15
17
</tr >
16
18
</table >
@@ -32,6 +34,15 @@ php --version
32
34
composer --version
33
35
```
34
36
37
+ Using [ Dev Containers] ( https://containers.dev/ ) ? We have a pre-built image:
38
+ ``` json
39
+ {
40
+ "image" : " opencodeco/phpctl:php83-devcontainer"
41
+ }
42
+ ```
43
+ In fact, we use it ourselves to develop ` phpctl ` itself: [ devcontainer.json] ( .devcontainer/devcontainer.json ) .
44
+
45
+
35
46
## Getting started
36
47
37
48
- [ Installation guide] ( https://phpctl.dev/#installation )
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
PHPCTL_DIR=$( dirname " $( realpath " $0 " ) " ) /../
3
+
4
+ if [ -s " $HOME /.phpctlrc" ]; then
5
+ set -a
6
+ . " $HOME /.phpctlrc"
7
+ set +a
8
+ fi
9
+
3
10
if [ -s .phpctlrc ]; then
4
11
set -a
5
12
. .phpctlrc
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env sh
2
+ set -e
3
+
4
+ SWOOLE_VERSION=" 5.1.2"
5
+ echo " Installing Swoole $SWOOLE_VERSION "
6
+
7
+ # Download
8
+ cd /usr/local/src
9
+ wget -q " https://github.com/swoole/swoole-src/archive/refs/tags/v${SWOOLE_VERSION} .zip"
10
+ unzip -q " v${SWOOLE_VERSION} .zip"
11
+
12
+ # Install
13
+ cd " swoole-src-${SWOOLE_VERSION} "
14
+ phpize
15
+ ./configure --enable-sockets --enable-openssl --enable-brotli --enable-mysqlnd --enable-cares --enable-swoole-curl --enable-swoole-pgsql --enable-swoole-sqlite
16
+ make -j$( nproc)
17
+ make install
18
+ echo " extension=swoole.so" >> /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini
19
+
20
+ # Clean up
21
+ cd ..
22
+ rm " v${SWOOLE_VERSION} .zip"
23
+ rm -r " swoole-src-${SWOOLE_VERSION} "
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env sh
2
+ set -e
2
3
3
4
box () {
4
5
local version=" 4.6.1"
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ FROM php:${PHP_VERSION_STR}-cli-bookworm
5
5
ENV PHP_VERSION $PHP_VERSION
6
6
7
7
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
8
- COPY rootfs .
9
8
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
10
- && apt-get -y install --no-install-recommends parallel unzip wget \
11
- && install-php-extensions decimal gd intl mongodb pcntl pdo_mysql pdo_pgsql pdo_sqlite rdkafka redis sockets swoole xdebug \
12
- && install-tools
9
+ && apt-get -y install --no-install-recommends libcurl4-openssl-dev libc-ares-dev libsqlite3-dev libpq-dev git unzip wget \
10
+ && mv /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini \
11
+ && mv /etc/php/php.ini /usr/local/etc/php/conf.d/zzphp.ini \
12
+ && install-php-extensions sockets && install-swoole && install-tools
Original file line number Diff line number Diff line change 14
14
"userUid" : " 1000" ,
15
15
"userGid" : " 1000" ,
16
16
"upgradePackages" : " true"
17
+ },
18
+ "ghcr.io/opencodeco/devcontainers/install-php-extensions:latest" : {
19
+ "extensions" : " decimal gd intl mongodb pcntl pcov pdo_mysql pdo_pgsql rdkafka redis xdebug"
17
20
}
18
21
},
22
+ "overrideFeatureInstallOrder" : [
23
+ " ghcr.io/devcontainers/features/common-utils"
24
+ ],
19
25
"remoteUser" : " phpctl"
20
26
}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ build() {
12
12
echo -e " Building \033[0;32m$PHPCTL_IMAGE \033[0m"
13
13
# shellcheck disable=SC2068
14
14
# shellcheck disable=SC2154
15
- $PHPCTL_RUNTIME buildx build --no-cache \
15
+ $PHPCTL_RUNTIME buildx build \
16
16
--build-arg PHP=" $PHP_VERSION " \
17
17
--build-arg COMPOSER_AUTH=" $COMPOSER_AUTH " \
18
18
--build-arg HOST_USER=" $( whoami) " \
@@ -51,6 +51,11 @@ run() {
51
51
composer_home=" -v $composer_home :$composer_home "
52
52
fi
53
53
54
+ local gitconfig=" "
55
+ if [ -f ~ /.gitconfig ]; then
56
+ gitconfig=" -v $HOME /.gitconfig:/root/.gitconfig:ro"
57
+ fi
58
+
54
59
if [ -n " $GIT_EXEC_PATH " ]; then
55
60
# In a Git hook environment, we need to disable TTY allocation
56
61
PHPCTL_TTY=" --label=no-tty"
@@ -68,7 +73,7 @@ run() {
68
73
--user " $PHPCTL_USER " \
69
74
$( env | awk -F= ' /^[[:alpha:]]/{print $1}' | sed ' s/^/-e/' ) \
70
75
-v /var/run/docker.sock:/var/run/docker.sock \
71
- -v ~ /. gitconfig:/root/.gitconfig:ro \
76
+ $ gitconfig \
72
77
-v " $( pwd) " :/usr/local/src -w /usr/local/src \
73
78
-v " $PHPCTL_DIR /php.ini:/etc/php$PHP_VERSION /conf.d/zphp.ini" \
74
79
$phpctl_ini \
Original file line number Diff line number Diff line change @@ -14,7 +14,4 @@ function test_composer() {
14
14
function test_phpctl_ini() {
15
15
echo " memory_limit=1337M" > phpctl.ini
16
16
assert_contains " memory_limit => 1337M => 1337M" " $( ./bin/phpctl php -i | grep memory_limit) "
17
- if [ -f phpctl.ini ]; then
18
- rm phpctl.ini
19
- fi
20
17
}
You can’t perform that action at this time.
0 commit comments