diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81712d5..553fe27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,82 +3,104 @@ on: push: branches: - master - -env: - BUILDKIT_IMAGE: jkaninda/laravel-php-fpm jobs: docker: runs-on: ubuntu-latest steps: - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - uses: docker/login-action@v3 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push 8.0 + name: Build and push 8.1 uses: docker/build-push-action@v3 with: - file: "./src/docker/8.0/Dockerfile" + file: "./src/docker/Dockerfile" push: true - tags: "${{env.BUILDKIT_IMAGE}}:8.0" + platforms: linux/amd64,linux/arm64 + build-args: | + phpVersion=8.1 + tags: "${{ vars.BUILDKIT_IMAGE }}:8.1" - - name: Build and push 8.1 + name: Build and push 8.1 alpine uses: docker/build-push-action@v3 with: - file: "./src/docker/8.1/Dockerfile" + file: "./src/docker/Dockerfile.alpine" push: true platforms: linux/amd64,linux/arm64 - tags: "${{env.BUILDKIT_IMAGE}}:8.1" + build-args: | + phpVersion=8.1 + tags: "${{ vars.BUILDKIT_IMAGE }}:8.1-alpine" - name: Build and push 8.2 uses: docker/build-push-action@v3 with: - file: "./src/docker/8.2/Dockerfile" + file: "./src/docker/Dockerfile" push: true platforms: linux/amd64,linux/arm64 - tags: "${{env.BUILDKIT_IMAGE}}:8.2" + build-args: | + phpVersion=8.2 + tags: "${{vars.BUILDKIT_IMAGE}}:8.2" - - name: Build and push 8.1 alpine + name: Build and push 8.2 alpine uses: docker/build-push-action@v3 with: - file: "./src/docker/8.1/Dockerfile.alpine" + file: "./src/docker/Dockerfile.alpine" push: true platforms: linux/amd64,linux/arm64 - tags: | - "${{env.BUILDKIT_IMAGE}}:8.1-alpine" + build-args: | + phpVersion=8.2 + tags: "${{vars.BUILDKIT_IMAGE}}:8.2-alpine" - - name: Build and push 8.2 alpine + name: Build and push 8.3 uses: docker/build-push-action@v3 with: - file: "./src/docker/8.2/Dockerfile.alpine" + file: "./src/docker/Dockerfile" push: true platforms: linux/amd64,linux/arm64 + build-args: | + phpVersion=8.3 tags: | - "${{env.BUILDKIT_IMAGE}}:8.2-alpine" + "${{vars.BUILDKIT_IMAGE}}:8.3" + "${{vars.BUILDKIT_IMAGE}}:latest" - name: Build and push 8.3 alpine uses: docker/build-push-action@v3 with: - file: "./src/docker/8.3/Dockerfile.alpine" + file: "./src/docker/Dockerfile.alpine" push: true platforms: linux/amd64,linux/arm64 + build-args: | + phpVersion=8.3 tags: | - "${{env.BUILDKIT_IMAGE}}:8.3-alpine" + "${{vars.BUILDKIT_IMAGE}}:8.3-alpine" - - name: Build and push 8.3 + name: Build and push 8.4 RC + uses: docker/build-push-action@v3 + with: + file: "./src/docker/Dockerfile" + push: true + platforms: linux/amd64,linux/arm64 + build-args: | + phpVersion=8.4.0RC4 + tags: | + "${{vars.BUILDKIT_IMAGE}}:8.4.0RC4" + - + name: Build and push 8.4 RC alpine uses: docker/build-push-action@v3 with: - file: "./src/docker/8.3/Dockerfile" + file: "./src/docker/Dockerfile.alpine" push: true platforms: linux/amd64,linux/arm64 + build-args: | + phpVersion=8.4.0RC4 tags: | - "${{env.BUILDKIT_IMAGE}}:8.3" - "${{env.BUILDKIT_IMAGE}}:latest" + "${{vars.BUILDKIT_IMAGE}}:8.4.0RC4-alpine" diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/tests.yml similarity index 98% rename from .github/workflows/integration-tests.yml rename to .github/workflows/tests.yml index 7ff15e3..cb563d5 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Integration Test +name: Tests on: push: jobs: diff --git a/Makefile b/Makefile index 8e0349b..a6b198b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,27 @@ -IMAGE_NAME:jkaninda/laravel-php-fpm -build-8.1: - docker buildx build -f src/docker/8.1/Dockerfile -t ${IMAGE_NAME}:8.1 . -build-8.2: - docker buildx build -f src/docker/8.2/Dockerfile -t ${IMAGE_NAME}:8.2 . -build-8.3: - docker buildx build -f src/docker/8.3/Dockerfile -t ${IMAGE_NAME}:8.3 . \ No newline at end of file +IMAGE_NAME?=jkaninda/laravel-php-fpm +.PHONY: all +all: build +##@ Build +.PHONY: build +build: build-81 build-82 build-83 build-84 +.PHONY: build-80 +build-80: + docker build --build-arg phpVersion=8.0 -f src/docker/8.0/Dockerfile -t ${IMAGE_NAME}:8.0 . +.PHONY: build-81 +build-81: + docker build --build-arg phpVersion=8.1 -f src/docker/Dockerfile -t ${IMAGE_NAME}:8.1 . +.PHONY: build-82 +build-82: + docker build --build-arg phpVersion=8.2 -f src/docker/Dockerfile -t ${IMAGE_NAME}:8.2 . +.PHONY: build-83 +build-83: + docker build --build-arg phpVersion=8.3 -f src/docker/Dockerfile -t ${IMAGE_NAME}:8.3 . +.PHONY: build-84 +build-84: + docker build --build-arg phpVersion=8.4.0RC4 -f src/docker/Dockerfile -t ${IMAGE_NAME}:8.4 . +.PHONY: build-81-alpine +build-81-alpine: + docker build --build-arg phpVersion=8.1 -f src/docker/Dockerfile.alpine -t ${IMAGE_NAME}:8.1-alpine . +.PHONY: build-84-alpine +build-84-alpine: + docker build --build-arg phpVersion=8.4.0RC4 -f src/docker/Dockerfile.alpine -t ${IMAGE_NAME}:8.4.0RC4-alpine . diff --git a/README.md b/README.md index 934e062..acaf51e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Build](https://github.com/jkaninda/laravel-php-fpm/actions/workflows/build.yml/badge.svg)](https://github.com/jkaninda/laravel-php-fpm/actions/workflows/build.yml) -[![Integration Test](https://github.com/jkaninda/laravel-php-fpm/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/jkaninda/laravel-php-fpm/actions/workflows/integration-tests.yml) +[![Tests](https://github.com/jkaninda/laravel-php-fpm/actions/workflows/tests.yml/badge.svg)](https://github.com/jkaninda/laravel-php-fpm/actions/workflows/tests.yml) ![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/jkaninda/laravel-php-fpm?style=flat-square) ![Docker Pulls](https://img.shields.io/docker/pulls/jkaninda/laravel-php-fpm?style=flat-square) diff --git a/src/docker/8.1/Dockerfile.alpine b/src/docker/8.1/Dockerfile.alpine deleted file mode 100644 index c8d6c12..0000000 --- a/src/docker/8.1/Dockerfile.alpine +++ /dev/null @@ -1,23 +0,0 @@ -FROM php:8.1-fpm-alpine -ARG WORKDIR=/var/www/html -ENV DOCUMENT_ROOT=${WORKDIR} -ENV LARAVEL_PROCS_NUMBER=1 -ARG GROUP_ID=1000 -ARG USER_ID=1000 -ENV USER_NAME=www-data -ARG GROUP_NAME=www-data - -# Install the PHP pdo_mysql extention -RUN docker-php-ext-install pdo_mysql - -# Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -# Set working directory -WORKDIR $WORKDIR - -RUN rm -Rf /var/www/* && \ -mkdir -p /var/www/html - -ADD src/index.php $WORKDIR/index.php -ADD src/php.ini $PHP_INI_DIR/conf.d/ diff --git a/src/docker/8.2/Dockerfile b/src/docker/8.2/Dockerfile deleted file mode 100644 index f84ec44..0000000 --- a/src/docker/8.2/Dockerfile +++ /dev/null @@ -1,102 +0,0 @@ -FROM php:8.2-fpm -ARG WORKDIR=/var/www/html -ENV DOCUMENT_ROOT=${WORKDIR} -ENV LARAVEL_PROCS_NUMBER=1 -ENV NODE_MAJOR=20 -ARG GROUP_ID=1000 -ARG USER_ID=1000 -ENV USER_NAME=www-data -ARG GROUP_NAME=www-data -# Install system dependencies -RUN apt-get update && apt-get install -y \ - git \ - curl \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmemcached-dev \ - libzip-dev \ - libpng-dev \ - libonig-dev \ - libxml2-dev \ - librdkafka-dev \ - libpq-dev \ - openssh-server \ - zip \ - unzip \ - supervisor \ - sqlite3 \ - nano \ - cron -# Install Nodejs -RUN apt-get update && apt-get install -y ca-certificates curl gnupg -RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg -RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list -RUN apt-get update && apt-get install nodejs -y - -# Clear cache -RUN apt-get clean && rm -rf /var/lib/apt/lists/* -# Install Kafka -RUN git clone https://github.com/arnaud-lb/php-rdkafka.git\ - && cd php-rdkafka \ - && phpize \ - && ./configure \ - && make all -j 5 \ - && make install - -# Install Rdkafka and enable it -RUN docker-php-ext-enable rdkafka \ - && cd .. \ - && rm -rf /php-rdkafka - -# Install PHP extensions zip, mbstring, exif, bcmath, intl -RUN docker-php-ext-configure gd --with-freetype --with-jpeg -RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl - -# Install Redis and enable it -RUN pecl install redis && docker-php-ext-enable redis - - - -# Install the php memcached extension -RUN pecl install memcached && docker-php-ext-enable memcached - -# Install the PHP pdo_mysql extention -RUN docker-php-ext-install pdo_mysql - -# Install the PHP pdo_pgsql extention -RUN docker-php-ext-install pdo_pgsql - -# Install PHP Opcache extention -RUN docker-php-ext-install opcache - - -# Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -# Set working directory -WORKDIR $WORKDIR - -RUN rm -Rf /var/www/* && \ -mkdir -p /var/www/html - -ADD src/index.php $WORKDIR/index.php -ADD src/php.ini $PHP_INI_DIR/conf.d/ -ADD src/opcache.ini $PHP_INI_DIR/conf.d/ -ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf - -COPY src/entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/entrypoint.sh -RUN ln -s /usr/local/bin/entrypoint.sh / - -ENTRYPOINT ["entrypoint.sh"] - -RUN usermod -u ${USER_ID} ${USER_NAME} -RUN groupmod -g ${USER_ID} ${GROUP_NAME} -RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \ - chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \ - chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \ - chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \ - chown -R ${USER_NAME}:${GROUP_NAME} /tmp - -EXPOSE 9000 -CMD [ "entrypoint" ] diff --git a/src/docker/8.3/Dockerfile b/src/docker/8.3/Dockerfile deleted file mode 100644 index e7fa813..0000000 --- a/src/docker/8.3/Dockerfile +++ /dev/null @@ -1,103 +0,0 @@ -FROM php:8.3.4-fpm -ARG WORKDIR=/var/www/html -ENV DOCUMENT_ROOT=${WORKDIR} -ENV LARAVEL_PROCS_NUMBER=1 -ENV NODE_MAJOR=20 -ARG GROUP_ID=1000 -ARG USER_ID=1000 -ENV USER_NAME=www-data -ARG GROUP_NAME=www-data -# Install system dependencies -RUN apt-get update && apt-get install -y \ - git \ - curl \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmemcached-dev \ - libzip-dev \ - libpng-dev \ - libonig-dev \ - libxml2-dev \ - librdkafka-dev \ - libpq-dev \ - openssh-server \ - zip \ - unzip \ - supervisor \ - sqlite3 \ - nano \ - cron -# Install Nodejs -RUN apt-get update && apt-get install -y ca-certificates curl gnupg -RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg -RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list -RUN apt-get update && apt-get install nodejs -y - -# Clear cache -RUN apt-get clean && rm -rf /var/lib/apt/lists/* -# Install Kafka -RUN git clone https://github.com/arnaud-lb/php-rdkafka.git\ - && cd php-rdkafka \ - && phpize \ - && ./configure \ - && make all -j 5 \ - && make install - -# Install Rdkafka and enable it -RUN docker-php-ext-enable rdkafka \ - && cd .. \ - && rm -rf /php-rdkafka - -# Install PHP extensions zip, mbstring, exif, bcmath, intl -RUN docker-php-ext-configure gd --with-freetype --with-jpeg -RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl - -# Install Redis and enable it -RUN pecl install redis && docker-php-ext-enable redis - - - -# Install the php memcached extension -RUN pecl install memcached && docker-php-ext-enable memcached - -# Install the PHP pdo_mysql extention -RUN docker-php-ext-install pdo_mysql - -# Install the PHP pdo_pgsql extention -RUN docker-php-ext-install pdo_pgsql - -# Install PHP Opcache extention -RUN docker-php-ext-install opcache - - -# Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -# Set working directory -WORKDIR $WORKDIR - -RUN rm -Rf /var/www/* && \ -mkdir -p /var/www/html - -ADD src/index.php $WORKDIR/index.php -ADD src/php.ini $PHP_INI_DIR/conf.d/ -ADD src/opcache.ini $PHP_INI_DIR/conf.d/ -ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf - -COPY src/entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/entrypoint.sh -RUN ln -s /usr/local/bin/entrypoint.sh / - - -ENTRYPOINT ["entrypoint.sh"] - -RUN usermod -u ${USER_ID} ${USER_NAME} -RUN groupmod -g ${USER_ID} ${GROUP_NAME} -RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \ - chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \ - chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \ - chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \ - chown -R ${USER_NAME}:${GROUP_NAME} /tmp - -EXPOSE 9000 -CMD [ "entrypoint" ] diff --git a/src/docker/8.3/Dockerfile.alpine b/src/docker/8.3/Dockerfile.alpine deleted file mode 100644 index c1061d4..0000000 --- a/src/docker/8.3/Dockerfile.alpine +++ /dev/null @@ -1,23 +0,0 @@ -FROM php:8.3-fpm-alpine -ARG WORKDIR=/var/www/html -ENV DOCUMENT_ROOT=${WORKDIR} -ENV LARAVEL_PROCS_NUMBER=1 -ARG GROUP_ID=1000 -ARG USER_ID=1000 -ENV USER_NAME=www-data -ARG GROUP_NAME=www-data - -# Install the PHP pdo_mysql extention -RUN docker-php-ext-install pdo_mysql - -# Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -# Set working directory -WORKDIR $WORKDIR - -RUN rm -Rf /var/www/* && \ -mkdir -p /var/www/html - -ADD src/index.php $WORKDIR/index.php -ADD src/php.ini $PHP_INI_DIR/conf.d/ diff --git a/src/docker/8.1/Dockerfile b/src/docker/Dockerfile similarity index 93% rename from src/docker/8.1/Dockerfile rename to src/docker/Dockerfile index 2c35901..94daed9 100644 --- a/src/docker/8.1/Dockerfile +++ b/src/docker/Dockerfile @@ -1,4 +1,5 @@ -FROM php:8.1-fpm +ARG phpVersion=8.3-dev +FROM php:${phpVersion}-fpm ARG WORKDIR=/var/www/html ENV DOCUMENT_ROOT=${WORKDIR} ENV LARAVEL_PROCS_NUMBER=1 @@ -27,7 +28,6 @@ RUN apt-get update && apt-get install -y \ sqlite3 \ nano \ cron - # Install Nodejs RUN apt-get update && apt-get install -y ca-certificates curl gnupg RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg @@ -70,6 +70,7 @@ RUN docker-php-ext-install pdo_pgsql # Install PHP Opcache extention RUN docker-php-ext-install opcache + # Install Composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer @@ -82,7 +83,6 @@ mkdir -p /var/www/html ADD src/index.php $WORKDIR/index.php ADD src/php.ini $PHP_INI_DIR/conf.d/ ADD src/opcache.ini $PHP_INI_DIR/conf.d/ - ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf COPY src/entrypoint.sh /usr/local/bin/ @@ -92,9 +92,9 @@ RUN ln -s /usr/local/bin/entrypoint.sh / ENTRYPOINT ["entrypoint.sh"] -RUN usermod -u ${USER_ID} ${USER_NAME} -RUN groupmod -g ${USER_ID} ${GROUP_NAME} -RUN chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \ +RUN usermod -u ${USER_ID} ${USER_NAME} && \ + groupmod -g ${USER_ID} ${GROUP_NAME} && \ + chown -R ${USER_NAME}:${GROUP_NAME} /var/www && \ chown -R ${USER_NAME}:${GROUP_NAME} /var/log/ && \ chown -R ${USER_NAME}:${GROUP_NAME} /etc/supervisor/conf.d/ && \ chown -R ${USER_NAME}:${GROUP_NAME} $PHP_INI_DIR/conf.d/ && \ diff --git a/src/docker/8.2/Dockerfile.alpine b/src/docker/Dockerfile.alpine similarity index 90% rename from src/docker/8.2/Dockerfile.alpine rename to src/docker/Dockerfile.alpine index f2990d5..a9d7d99 100644 --- a/src/docker/8.2/Dockerfile.alpine +++ b/src/docker/Dockerfile.alpine @@ -1,4 +1,5 @@ -FROM php:8.2-fpm-alpine +ARG phpVersion=8.3-dev +FROM php:${phpVersion}-fpm-alpine ARG WORKDIR=/var/www/html ENV DOCUMENT_ROOT=${WORKDIR} ENV LARAVEL_PROCS_NUMBER=1