Skip to content

Commit

Permalink
adds php 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
matiux committed Dec 30, 2023
1 parent b78fa5a commit 0e7c9ab
Show file tree
Hide file tree
Showing 12 changed files with 620 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/php-fpm-83-bullseye-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build PHP 8.3 base

on: [ workflow_dispatch ]

jobs:
# define job to build and publish docker image
build-and-push-docker-image:
name: Build Docker image and push to repositories
# run only when code is compiling and tests are passing
runs-on: ubuntu-latest

# steps to perform in job
steps:
- name: Checkout code
uses: actions/checkout@v2

# setup Docker build action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build 8.3 base image and push to Docker Hub Registry
uses: docker/build-push-action@v2
with:
# relative path to the place where source code with Dockerfile is located
context: ./php/debian/bookworm/8.3/fpm/base
# Note: tags has to be all lower-case
# matiux/php-fpm-8.3-bookworm-base:latest
tags: |
matiux/php:fpm-8.3-bookworm-base
# build on feature branches, push only on master branch
push: ${{ github.ref == 'refs/heads/master' }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
41 changes: 41 additions & 0 deletions .github/workflows/php-fpm-83-bullseye-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build PHP 8.3 dev

on: [ workflow_dispatch ]

jobs:
# define job to build and publish docker image
build-and-push-docker-image:
name: Build Docker image and push to repositories
# run only when code is compiling and tests are passing
runs-on: ubuntu-latest

# steps to perform in job
steps:
- name: Checkout code
uses: actions/checkout@v2

# setup Docker build action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build 8.3 image and push to Docker Hub Registry
uses: docker/build-push-action@v2
with:
# relative path to the place where source code with Dockerfile is located
context: ./php/debian/bookworm/8.3/fpm/dev
# Note: tags has to be all lower-case
# matiux/php-fpm-8.2-bookworm-dev:latest
tags: |
matiux/php:fpm-8.3-bookworm-dev
# build on feature branches, push only on master branch
push: ${{ github.ref == 'refs/heads/master' }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
50 changes: 50 additions & 0 deletions php/debian/bookworm/8.3/fpm/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM php:8.3-fpm-bookworm

MAINTAINER Matteo Galacci <m.galacci@gmail.com>

#ARG PHP_VERSION=$(php -v | grep ^PHP | cut -d' ' -f2)

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
less \
libicu-dev \
libmemcached-dev \
libmemcached11 \
libncurses5-dev \
libxml2 \
libzip-dev \
php-memcached \
unzip \
vim \
zip \
zlib1g-dev \
# && pecl install -o \
# memcached-3.2.0 \
# && docker-php-ext-enable \
# memcached \
&& docker-php-ext-install -j5 \
#`-j` è come per make, per usare 5 thread, accelera la compilazione
#la regola è che è sempre meglio averla più alta del numero di core a disposizione. La sfiga è che non
#si può parametrizzare, o ti si invalida la cache della build perché Docker vede un'istruzione diversa
#(se cambi il parametro)
bcmath \
intl \
opcache \
pdo_mysql \
zip \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*

###> Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
###> Fine composer

WORKDIR /var/www/app

# php.ini
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

USER www-data
101 changes: 101 additions & 0 deletions php/debian/bookworm/8.3/fpm/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
FROM matiux/php:fpm-8.3-bullseye-base

MAINTAINER Matteo Galacci <m.galacci@gmail.com>

USER root

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
awscli \
curl \
default-mysql-client \
git \
iproute2 \
locales \
locales-all \
mycli \
nano \
rsync \
tzdata \
ssh \
sudo \
vim \
wget \
zsh

###> Configurazioni e permessi
ENV TZ=Europe/Rome
RUN locale-gen en_US.UTF-8

RUN echo 'memory_limit = 2048M' >> "$PHP_INI_DIR/conf.d/docker-php-memlimit.ini" \
&& chown -R www-data:www-data /var/www \
&& groupadd -g 1000 utente \
&& useradd -m -u 1000 -g www-data utente \
&& usermod -aG www-data utente

COPY conf/sudo-DEV /etc/sudoers.d/DEV
###> Fine configurazioni e permessi

###> Configurazione Xdebug
ENV XDEBUG_CONF_FILE=$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini
ENV PHP_IDE_CONFIG=serverName=application
RUN chown utente:utente /usr/local/etc/php/conf.d/
COPY --chown=www-data:www-data conf/xdebug.ini $XDEBUG_CONF_FILE

RUN apt-get install -y --no-install-recommends \
&& pecl install xdebug-3.3.1 \
&& docker-php-ext-enable xdebug
###> Fine configurazione Xdebug

###> Zsh
RUN apt-get install -y --no-install-recommends \
locales

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

USER utente

RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true

COPY --chown=utente:utente conf/zshrc /home/utente/.zshrc

COPY --chown=utente:utente conf/custom-agnoster.zsh-theme /home/utente/.oh-my-zsh/custom/themes/custom-agnoster.zsh-theme
RUN sed -i "s/ZSH_THEME=\"robbyrussell\"/ZSH_THEME=\"custom-agnoster\"/" ~/.zshrc \
&& echo "\nexport DEFAULT_USER=utente" >> ~/.zshrc
###> Fine zsh

###> Configurazione aws-vault e plugin zsh dentro al container
RUN sudo curl -L -o /usr/local/bin/aws-vault https://github.com/99designs/aws-vault/releases/download/v6.5.0/aws-vault-linux-amd64
RUN sudo chmod 755 /usr/local/bin/aws-vault

RUN git clone https://github.com/blimmer/zsh-aws-vault.git ~/.oh-my-zsh/custom/plugins/zsh-aws-vault \
&& sed -i.bak 's/^plugins=(\(.*\)/plugins=(zsh-aws-vault \1/' ~/.zshrc
###> Fine configurazione aws-vault e plugin zsh dentro al container

###> Configurazione Zsh Autosuggestions
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
&& sed -i.bak 's/^plugins=(\(.*\)/plugins=(zsh-autosuggestions \1/' ~/.zshrc \
&& echo "export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=\"fg=#0cb074\"" >> ~/.zshrc
###> Fine configurazione Zsh Autosuggestions

###> Shell
COPY conf/project-autocomplete /etc/bash_completion.d

COPY --chown=utente:utente conf/shell-custom.rc /tmp/shell-custom.rc
RUN echo "" >> /tmp/shell-custom.rc \
&& cat /tmp/shell-custom.rc >> /home/utente/.zshrc \
&& cat /tmp/shell-custom.rc >> /home/utente/.bashrc
###> Fine Shell

###> Pulizia
USER root

RUN apt-get remove --purge -y software-properties-common \
&& apt-get autoremove -y \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
###> Fine pulizia

USER www-data
Loading

0 comments on commit 0e7c9ab

Please sign in to comment.