Skip to content

Commit

Permalink
#16671 - Add PHP8.4 into docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Jan 27, 2025
1 parent 190c697 commit 53564da
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ services:
volumes:
- .:/srv

cphalcon-8.4:
container_name: cphalcon-8.4
hostname: cphalcon-84
build: docker/8.4
working_dir: /srv
volumes:
- .:/srv

mysql:
container_name: cphalcon-mysql
image: mysql:5.7
Expand Down
96 changes: 96 additions & 0 deletions docker/8.4/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash

# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"

# Shortcuts
alias g="git"
alias h="history"

# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi

# List all files colorized in long format
# shellcheck disable=SC2139
alias l="ls -lF ${colorflag}"

# List all files colorized in long format, including dot files
# shellcheck disable=SC2139
alias la="ls -laF ${colorflag}"

# List only directories
# shellcheck disable=SC2139
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"

# See: https://superuser.com/a/656746/280737
alias ll='LC_ALL="C.UTF-8" ls -alF'

# Always use color output for `ls`
# shellcheck disable=SC2139
alias ls="command ls ${colorflag}"
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'

# Always enable colored `grep` output
alias grep='grep --color=auto '

# Enable aliases to be sudo’ed
alias sudo='sudo '

# Get week number
alias week='date +%V'

# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'

# Canonical hex dump; some systems have this symlinked
command -v hd > /dev/null || alias hd="hexdump -C"

# vhosts
alias hosts='sudo nano /etc/hosts'

# copy working directory
alias cwd='pwd | tr -d "\r\n" | xclip -selection clipboard'

# copy file interactive
alias cp='cp -i'

# move file interactive
alias mv='mv -i'

# untar
alias untar='tar xvf'

# Zephir related
alias untar='tar xvf'

NB_CORES=$(grep -c '^processor' /proc/cpuinfo)
export MAKEFLAGS="-j$((NB_CORES)) -l${NB_CORES}"

alias zephir='./vendor/bin/zephir '
alias zf='./vendor/bin/zephir fullclean'
alias zg='./vendor/bin/zephir generate'
alias zs='./vendor/bin/zephir stubs'
alias cpl='zf && zg && cd ext/ && ./install && ..'
alias codecept='php -d extension=ext/modules/phalcon.so ./vendor/bin/codecept '
alias phpcs='php -d extension=ext/modules/phalcon.so ./vendor/bin/phpcs '
alias phpcbf='php -d extension=ext/modules/phalcon.so ./vendor/bin/phpcbf '
alias psalm='php ./vendor/bin/psalm '

alias test-unit='php -d extension=ext/modules/phalcon.so vendor/bin/codecept run --ext DotReporter unit'
alias test-cli='php -d extension=ext/modules/phalcon.so vendor/bin/codecept run --ext DotReporter cli'
alias test-integration='php -d extension=ext/modules/phalcon.so vendor/bin/codecept run --ext DotReporter integration'
alias test-db-common='php -d extension=ext/modules/phalcon.so vendor/bin/codecept run --ext DotReporter database -g common'
alias test-db-mysql='php -d extension=ext/modules/phalcon.so vendor/bin/codecept run --ext DotReporter database --env mysql -g mysql'
alias test-db-pgsql='php -d extension=ext/modules/phalcon.so vendor/bin/codecept run --ext DotReporter database --env pgsql -g pgsql'
alias test-db-sqlite='php -d extension=ext/modules/phalcon.so vendor/bin/codecept run --ext DotReporter database --env sqlite -g sqlite'
alias test-db='test-db-common && test-db-mysql && test-db-pgsql && test-db-sqlite'
alias test-all='test-unit && test-cli && test-integration && test-db'
102 changes: 102 additions & 0 deletions docker/8.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
FROM composer:latest as composer
FROM php:8.4-fpm

ADD ./extra.ini /usr/local/etc/php/conf.d/

# User/Group globals
ENV MY_USER="phalcon" \
MY_GROUP="phalcon" \
MY_UID="1000" \
MY_GID="1000" \
PHP_VERSION="8.3" \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=en_US.UTF-8

# User and Group
RUN set -eux && \
groupadd -g ${MY_GID} -r ${MY_GROUP} && \
useradd -u ${MY_UID} -m -s /bin/bash -g ${MY_GROUP} ${MY_USER}

# Update
RUN apt update -y && \
apt install -y \
apt-utils \
gettext \
git \
libgmp-dev \
libicu-dev \
libmagickwand-dev \
libmemcached-dev \
libpng-dev \
libpq-dev \
libyaml-dev \
libwebp-dev \
libxpm-dev \
libzip-dev \
locales \
nano \
sudo \
wget \
zip

# Remove this RUN when imagick will be available via pecl
RUN cd /opt && \
git clone https://github.com/Imagick/imagick.git && \
cd imagick && \
phpize && ./configure && \
make && make install

# PECL Packages
RUN pecl install -o -f redis && \
pecl install igbinary \
msgpack \
apcu \
yaml \
# imagick \
memcached \
zephir_parser

# Locale
RUN sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# el_GR.UTF-8 UTF-8/el_GR.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8

# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype \
--with-jpeg=/usr/include/ \
--with-xpm \
--with-webp \
--enable-gd

RUN docker-php-ext-install \
gd \
gettext \
gmp \
intl \
pdo_mysql \
pdo_pgsql \
zip

# Install PHP extensions
RUN docker-php-ext-enable \
redis \
igbinary \
msgpack \
apcu \
imagick \
yaml \
memcached \
zephir_parser

# Composer
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
# Bash script with helper aliases
COPY ./.bashrc /root/.bashrc
COPY ./.bashrc /home/phalcon/.bashrc

CMD ["php-fpm"]
8 changes: 8 additions & 0 deletions docker/8.4/extra.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error_reporting=E_ALL
display_errors="On"
display_startup_errors="On"
log_errors="On"
error_log=/tmp/php_errors.log
memory_limit=512M
apc.enable_cli="On"
session.save_path="/tmp"

0 comments on commit 53564da

Please sign in to comment.