Skip to content

Commit

Permalink
Add 8.4 Unit build
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed Oct 20, 2024
1 parent df89269 commit e23b19f
Show file tree
Hide file tree
Showing 17 changed files with 729 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/8.4.unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build Docker Images for PHP 8.4 with Nginx Unit
on:
workflow_dispatch:
branches:
- master
paths:
- "8/8.4/Dockerfile.nunit"
- "8/8.4/Dockerfile.nunit.dev"
push:
branches:
- "master"
paths:
- "8/8.4/Dockerfile.nunit"
- "8/8.4/Dockerfile.nunit.dev"
jobs:
docker-build-and-push:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
## Login to all 3 registries: DockerHub, GitHub Actions Container Registry, and Quay.io ##
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to the GitHub Actions Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to the Quay.io Container Registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Checkout code
uses: actions/checkout@v2
## Build and push the Docker image ##
- name: Build and push the Unit Production Image
uses: docker/build-push-action@v5
with:
context: 8/8.4
platforms: linux/amd64,linux/arm64
file: 8/8.4/Dockerfile.nunit
build-args: |
PHP_VERSION=8.4
push: true
tags: |
islamicnetwork/php:8.4-unit
ghcr.io/islamic-network/php:8.4-unit
quay.io/islamic-network/php:8.4-unit
- name: Build and push the Unit Development Image
uses: docker/build-push-action@v5
with:
context: 8/8.4
platforms: linux/amd64,linux/arm64
file: 8/8.4/Dockerfile.nunit.dev
build-args: |
PHP_VERSION=8.4
push: true
tags: |
islamicnetwork/php:8.4-unit-dev
ghcr.io/islamic-network/php:8.4-unit-dev
quay.io/islamic-network/php:8.4-unit-dev
101 changes: 101 additions & 0 deletions 8/8.4/Dockerfile.apache
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
ARG PHP_VERSION=$PHP_VERSION
FROM php:${PHP_VERSION}-apache

# Setup Debian
RUN apt-get -y update && apt-get -y upgrade && ACCEPT_EULA=Y && apt-get install -y \
unzip \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libmemcached-dev \
libzip-dev \
libgeoip-dev \
libxml2-dev \
libxslt-dev \
libtidy-dev \
libssl-dev \
zlib1g-dev \
libpng-dev \
libwebp-dev \
libgmp-dev \
libyaml-dev \
libjpeg-dev \
libfreetype6-dev \
libaio1 \
libldap2-dev \
libonig-dev \
apt-file \
wget \
vim \
gnupg \
gnupg2 \
zip \
git \
gcc \
g++ \
librdkafka-dev \
autoconf \
libc-dev \
libc-client-dev \
pkg-config \
libkrb5-dev \
iputils-ping \
&& rm -r /var/lib/apt/lists/* \
&& pecl install redis \
&& pecl install apcu \
&& pecl install memcached \
&& pecl install timezonedb \
&& pecl install yaml \
&& pecl install rdkafka \
&& pecl install apfd \
&& docker-php-ext-configure gd --with-freetype --with-webp --with-jpeg \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install gd calendar gmp ldap sysvmsg pcntl bcmath tidy gettext intl pdo_mysql mysqli simplexml xml xsl xmlwriter zip opcache exif sockets imap \
&& docker-php-ext-enable redis yaml apcu memcached timezonedb rdkafka apfd \
&& printf "log_errors = On \nerror_log = /dev/stderr\n" > /usr/local/etc/php/conf.d/php-logs.ini

# Install yq
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && \
chmod +x /usr/bin/yq

# Apache settings
COPY etc/apache2/conf-enabled/host.conf /etc/apache2/conf-enabled/host.conf
COPY etc/apache2/apache2.conf /etc/apache2/apache2.conf
COPY etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/000-default.conf

# PHP settings
COPY etc/php/production.ini /usr/local/etc/php/conf.d/production.ini

# Composer
RUN mkdir -p /usr/local/ssh
COPY etc/ssh/* /usr/local/ssh/
RUN sh /usr/local/ssh/install-composer.sh && \
mv composer.phar /usr/local/bin/composer && \
a2enmod proxy && \
a2enmod proxy_http && \
a2enmod proxy_ajp && \
a2enmod rewrite && \
a2enmod deflate && \
a2enmod headers && \
a2enmod proxy_balancer && \
a2enmod proxy_connect && \
a2enmod ssl && \
a2enmod cache && \
a2enmod expires && \
# Run apache on port 8080 instead of 80 due. On linux, ports under 1024 require admin privileges and we run apache as www-data.
sed -i 's/Listen 80/Listen 8080/g' /etc/apache2/ports.conf && \
chmod g+w /var/log/apache2 && \
chmod 777 /var/lock/apache2 && \
chmod 777 /var/run/apache2 && \
echo "<?php echo phpinfo(); ?>" > /var/www/html/phpinfo.php

COPY var/www/html/index.php /var/www/html/index.php

EXPOSE 8080

### PROD ENVIRONMENT SPECIFIC ###
################################

ENV PROVISION_CONTEXT "production"

################################
15 changes: 15 additions & 0 deletions 8/8.4/Dockerfile.apache.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG PHP_VERSION=$PHP_VERSION
FROM ghcr.io/islamic-network/php:${PHP_VERSION}-apache

### DEV ENVIRONMENT SPECIFIC ###
################################
ENV PROVISION_CONTEXT "development"
RUN pecl install xdebug && docker-php-ext-enable xdebug && touch /var/log/xdebug.log && chmod 777 /var/log/xdebug.log

# Add Development PHP.ini
COPY etc/php/development.ini /usr/local/etc/php/conf.d/development.ini

# Remove Production PHP.ini
RUN rm -rf /usr/local/etc/php/conf.d/production.ini

################################
77 changes: 77 additions & 0 deletions 8/8.4/Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
ARG PHP_VERSION=$PHP_VERSION
FROM php:${PHP_VERSION}-cli

# Setup Debian
RUN apt-get -y update && apt-get -y upgrade && ACCEPT_EULA=Y && apt-get install -y \
unzip \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libmemcached-dev \
libzip-dev \
libgeoip-dev \
libxml2-dev \
libxslt-dev \
libtidy-dev \
libssl-dev \
zlib1g-dev \
libpng-dev \
libwebp-dev \
libgmp-dev \
libjpeg-dev \
libyaml-dev \
libfreetype6-dev \
libaio1 \
libldap2-dev \
libonig-dev \
apt-file \
wget \
vim \
gnupg \
gnupg2 \
zip \
git \
curl \
jq \
gcc \
g++ \
librdkafka-dev \
autoconf \
libc-dev \
pkg-config \
iputils-ping \
&& pecl install redis \
&& pecl install apcu \
&& pecl install memcached \
&& pecl install timezonedb \
#&& pecl install grpc \
&& pecl install rdkafka \
&& pecl install yaml \
&& docker-php-ext-configure gd --with-freetype --with-webp --with-jpeg \
&& docker-php-ext-install gd calendar gmp ldap sysvmsg pcntl iconv bcmath xml mbstring pdo tidy gettext intl pdo_mysql mysqli simplexml xml xsl xmlwriter zip opcache exif sockets \
&& docker-php-ext-enable redis apcu memcached timezonedb rdkafka yaml \
&& printf "log_errors = On \nerror_log = /dev/stderr\n" > /usr/local/etc/php/conf.d/php-logs.ini

# PHP settings
COPY etc/php/production.ini /usr/local/etc/php/conf.d/production.ini

# Composer
RUN mkdir -p /usr/local/ssh
COPY etc/ssh/* /usr/local/ssh/
RUN sh /usr/local/ssh/install-composer.sh && \
mv composer.phar /usr/local/bin/composer

## Install kubectl and yq
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod u+x ./kubectl && \
mv ./kubectl /usr/bin/kubectl && \
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && \
chmod +x /usr/bin/yq


### PROD ENVIRONMENT SPECIFIC ###
################################

ENV PROVISION_CONTEXT "cli"

################################
73 changes: 73 additions & 0 deletions 8/8.4/Dockerfile.nunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
FROM unit:php8.3

# Setup Debian
RUN apt-get -y update && apt-get -y upgrade && ACCEPT_EULA=Y && apt-get install -y \
unzip \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libmemcached-dev \
libzip-dev \
libgeoip-dev \
libxml2-dev \
libxslt-dev \
libtidy-dev \
libssl-dev \
zlib1g-dev \
libpng-dev \
libwebp-dev \
libgmp-dev \
libyaml-dev \
libjpeg-dev \
libfreetype6-dev \
libaio1 \
libldap2-dev \
libonig-dev \
apt-file \
wget \
vim \
gnupg \
gnupg2 \
zip \
git \
gcc \
g++ \
librdkafka-dev \
autoconf \
libc-dev \
libc-client-dev \
pkg-config \
libkrb5-dev \
iputils-ping \
procps \
&& rm -r /var/lib/apt/lists/* \
&& pecl install redis \
&& pecl install apcu \
&& pecl install memcached \
&& pecl install timezonedb \
&& pecl install yaml \
&& pecl install rdkafka \
&& pecl install apfd \
&& docker-php-ext-configure gd --with-freetype --with-webp --with-jpeg \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install gd calendar gmp ldap sysvmsg pcntl bcmath tidy gettext intl pdo_mysql mysqli simplexml xml xsl xmlwriter zip opcache exif sockets imap \
#&& docker-php-ext-enable redis yaml apcu memcached timezonedb grpc rdkafka apfd
&& docker-php-ext-enable redis apcu memcached timezonedb rdkafka apfd

# Install yq
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && \
chmod +x /usr/bin/yq

# Composer
RUN mkdir -p /usr/local/ssh
COPY etc/ssh/* /usr/local/ssh/
RUN sh /usr/local/ssh/install-composer.sh && mv composer.phar /usr/local/bin/composer

# forward log to docker log collector
RUN ln -sf /dev/stdout /var/log/unit.log

ENV PROVISION_CONTEXT "nunit_production"
RUN echo "<?php echo phpinfo(); ?>" > /var/www/html/phpinfo.php

# Add Development PHP.ini
COPY etc/php/production.ini /usr/local/etc/php/conf.d/production.ini
6 changes: 6 additions & 0 deletions 8/8.4/Dockerfile.nunit.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ghcr.io/islamic-network/php:8.2-unit

ENV PROVISION_CONTEXT "nunit_development"

# Add Development PHP.ini
COPY etc/php/development.ini /usr/local/etc/php/conf.d/production.ini
18 changes: 18 additions & 0 deletions 8/8.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```
docker build . -t islamicnetwork/php:8.4-cli --build-arg PHP_VERSION=8.4 -f Dockerfile.cli
docker build . -t islamicnetwork/php:8.4-apache --build-arg PHP_VERSION=8.4 -f Dockerfile.apache
docker build . -t islamicnetwork/php:8.4-apache-dev --build-arg PHP_VERSION=8.4 -f Dockerfile.apache.dev
docker tag islamicnetwork/php:8.4-cli quay.io/islamic-network/php:8.4-cli
docker tag islamicnetwork/php:8.4-apache quay.io/islamic-network/php:8.4-apache
docker tag islamicnetwork/php:8.4-apache-dev quay.io/islamic-network/php:8.4-apache-dev
docker push islamicnetwork/php:8.4-cli
docker push quay.io/islamic-network/php:8.4-cli
docker push islamicnetwork/php:8.4-apache
docker push quay.io/islamic-network/php:8.4-apache
docker push islamicnetwork/php:8.4-apache-dev
docker push quay.io/islamic-network/php:8.4-apache-dev
```


Loading

0 comments on commit e23b19f

Please sign in to comment.