diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000000..c3b7c18420 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,265 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Publish Docker image + +on: + push: + branchs: master + +jobs: + + push_to_registries_phalcon: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + tjipenk/webserver + ghcr.io/${{ github.repository }} + + - name: Build php phalcon 7.3 + id: push_ver_phalcon73 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/phalcon73 + push: true + tags: tjipenk/webserver:phalcon73 + labels: ${{ steps.meta.outputs.labels }} + + + push_to_registries_php5: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + tjipenk/webserver + ghcr.io/${{ github.repository }} + + - name: Build php 5.4 + id: push_ver54 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php54 + push: true + tags: tjipenk/webserver:php54 + labels: ${{ steps.meta.outputs.labels }} + - name: Build php 5.4 oci + id: push_ver54oci + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php54-oci + push: true + tags: tjipenk/webserver:php54-oci + labels: ${{ steps.meta.outputs.labels }} + - name: Build php 5.6 + id: push_ver56 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php56 + push: true + tags: tjipenk/webserver:php56 + labels: ${{ steps.meta.outputs.labels }} + - name: Build php 5.6 oci + id: push_ver56oci + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php56-oci + push: true + tags: tjipenk/webserver:php56-oci + labels: ${{ steps.meta.outputs.labels }} + + push_to_registries_php7: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + tjipenk/webserver + ghcr.io/${{ github.repository }} + + - name: Build php 7.1 + id: push_ver71 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php71 + push: true + tags: tjipenk/webserver:php71 + labels: ${{ steps.meta.outputs.labels }} + + - name: Build php 7.2 + id: push_ver72 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php72 + push: true + tags: tjipenk/webserver:php72 + labels: ${{ steps.meta.outputs.labels }} + + - name: Build php 7.3 + id: push_ver73 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php73 + push: true + tags: tjipenk/webserver:php73 + labels: ${{ steps.meta.outputs.labels }} + + - name: Build php 7.4 + id: push_ver74 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php74 + push: true + tags: tjipenk/webserver:php74 + labels: ${{ steps.meta.outputs.labels }} + + push_to_registries_php8: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + tjipenk/webserver + ghcr.io/${{ github.repository }} + + - name: Build php 8.0 + id: push_ver8 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php8 + push: true + tags: tjipenk/webserver:php8 + labels: ${{ steps.meta.outputs.labels }} + + - name: Build php 8.1 + id: push_ver81 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php81 + push: true + tags: tjipenk/webserver:php81 + labels: ${{ steps.meta.outputs.labels }} + + - name: Build php 8.2 + id: push_ver82 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php82 + push: true + tags: tjipenk/webserver:php82 + labels: ${{ steps.meta.outputs.labels }} + + - name: Build php 8.3 + id: push_ver83 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: ./bin/php83 + push: true + tags: tjipenk/webserver:php83 + labels: ${{ steps.meta.outputs.labels }} + + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..6c2ff60b60 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "githubPullRequests.ignoredPullRequestBranches": [ + "master" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 127c17789f..de42c11844 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ As of now, we have several different PHP versions. Use appropriate php version a - Run the `docker compose up -d`. ```shell -git clone https://github.com/sprintcube/docker-compose-lamp.git +git clone https://github.com/tjipenk/docker-compose-lamp.git cd docker-compose-lamp/ cp sample.env .env // modify sample.env as needed diff --git a/bash_webserver.sh b/bash_webserver.sh new file mode 100755 index 0000000000..cda209ea52 --- /dev/null +++ b/bash_webserver.sh @@ -0,0 +1 @@ +docker compose run --rm webserver bash diff --git a/bin/crond/Dockerfile b/bin/crond/Dockerfile new file mode 100644 index 0000000000..89d3ef77ea --- /dev/null +++ b/bin/crond/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:latest + +LABEL maintainer="Alvin F" + +RUN apk add --no-cache curl + +###################### +# Run crond # +# -f for Foreground # +###################### + +CMD ["/usr/sbin/crond", "-f"] diff --git a/bin/laravel10/Dockerfile b/bin/laravel10/Dockerfile new file mode 100644 index 0000000000..e91af3cdfd --- /dev/null +++ b/bin/laravel10/Dockerfile @@ -0,0 +1,64 @@ +FROM ubuntu:22.04 + +LABEL maintainer="Taylor Otwell" + +ARG WWWGROUP +ARG NODE_VERSION=18 +ARG POSTGRES_VERSION=15 + +WORKDIR /var/www/html + +ENV DEBIAN_FRONTEND noninteractive +ENV TZ=UTC + +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt-get update \ + && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python +2 dnsutils librsvg2-bin \ + && curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg + --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \ + && echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jam +my main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ + && apt-get update \ + && apt-get install -y php8.2-cli php8.2-dev \ + php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \ + php8.2-curl \ + php8.2-imap php8.2-mysql php8.2-mbstring \ + php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \ + php8.2-intl php8.2-readline \ + php8.2-ldap \ + php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \ + php8.2-memcached php8.2-pcov php8.2-xdebug \ + && curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \ + && curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ + && apt-get install -y nodejs \ + && npm install -g npm \ + && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \ + && echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.l +ist.d/yarn.list \ + && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/de +v/null \ + && echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/ +apt/sources.list.d/pgdg.list \ + && apt-get update \ + && apt-get install -y yarn \ + && apt-get install -y mysql-client \ + && apt-get install -y postgresql-client-$POSTGRES_VERSION \ + && apt-get -y autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2 + +RUN groupadd --force -g $WWWGROUP sail +RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail + +COPY start-container /usr/local/bin/start-container +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini +RUN chmod +x /usr/local/bin/start-container + +EXPOSE 8000 + +ENTRYPOINT ["start-container"] \ No newline at end of file diff --git a/bin/laravel10/php.ini b/bin/laravel10/php.ini new file mode 100644 index 0000000000..97f0ba9ffe --- /dev/null +++ b/bin/laravel10/php.ini @@ -0,0 +1,7 @@ +[PHP] +post_max_size = 100M +upload_max_filesize = 100M +variables_order = EGPCS + +[opcache] +opcache.enable_cli=1 \ No newline at end of file diff --git a/bin/laravel10/start-container b/bin/laravel10/start-container new file mode 100644 index 0000000000..7651ecd1f6 --- /dev/null +++ b/bin/laravel10/start-container @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +if [ ! -z "$WWWUSER" ]; then + usermod -u $WWWUSER sail +fi + +if [ ! -d /.composer ]; then + mkdir /.composer +fi + +chmod -R ugo+rw /.composer + +if [ $# -gt 0 ]; then + exec gosu $WWWUSER "$@" +else + exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf +fi \ No newline at end of file diff --git a/bin/laravel10/supervisord.conf b/bin/laravel10/supervisord.conf new file mode 100644 index 0000000000..4d0a68ec3c --- /dev/null +++ b/bin/laravel10/supervisord.conf @@ -0,0 +1,14 @@ +[supervisord] +nodaemon=true +user=root +logfile=/var/log/supervisor/supervisord.log +pidfile=/var/run/supervisord.pid + +[program:php] +command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80 +user=sail +environment=LARAVEL_SAIL="1" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 \ No newline at end of file diff --git a/bin/phalcon73/Dockerfile b/bin/phalcon73/Dockerfile new file mode 100644 index 0000000000..f43c6cb0a9 --- /dev/null +++ b/bin/phalcon73/Dockerfile @@ -0,0 +1,59 @@ +FROM php:7.3.33-apache + +# install composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +ENV COMPOSER_ALLOW_SUPERUSER=1 + +# install nodejs and npm +RUN apt update && \ + apt install nodejs npm -y + +# install libpng-dev +RUN apt install libpng-dev -y + +# install libfreetype6-dev libjpeg62-turbo-dev +RUN apt install libfreetype6-dev libjpeg62-turbo-dev -y + +# install cron +RUN apt install vim -y + +# install zip unzip +RUN apt install zip unzip + +# install zip unzip +RUN apt install cron -y + +# libicu untuk ext-intl +RUN apt install libicu-dev -y + +# libicu untuk ext-intl +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ +&& docker-php-ext-install gd + +# install extension +RUN docker-php-ext-install \ + mysqli \ + pdo_mysql \ + intl + +RUN mkdir /cphalcon + +RUN git clone https://github.com/phalcon/cphalcon /cphalcon \ + && cd /cphalcon/build \ + && git checkout origin/3.4.x \ + && ./install + +EXPOSE 80 + +WORKDIR /var/www/html + +COPY ./ /var/www/html/ + +RUN apt install git -y + +# RUN composer install + +RUN a2enmod rewrite headers proxy proxy_http + +# CMD cron && /usr/sbin/apache2ctl -D FOREGROUND +CMD /usr/sbin/apache2ctl -D FOREGROUND diff --git a/bin/php54-oci/Dockerfile b/bin/php54-oci/Dockerfile new file mode 100644 index 0000000000..1f278bcb44 --- /dev/null +++ b/bin/php54-oci/Dockerfile @@ -0,0 +1,77 @@ +FROM php:5.4-apache + +# Backup and clean source.list file +RUN cp /etc/apt/sources.list /etc/apt/sources.list.old && \ + cat /dev/null > /etc/apt/sources.list + +# Fix the source.list for jessie +RUN printf "deb http://archive.debian.org/debian/ jessie main\n" > /etc/apt/sources.list && \ + printf "deb-src http://archive.debian.org/debian/ jessie main\n" >> /etc/apt/sources.list && \ + printf "deb http://archive.debian.org/debian-security jessie/updates main\n" >> /etc/apt/sources.list && \ + printf "deb-src http://archive.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list + +RUN apt-get -y --allow-unauthenticated update && apt-get upgrade -y --allow-unauthenticated + +# Install tools && libraries +RUN apt-get -y --allow-unauthenticated install --fix-missing apt-utils nano wget dialog \ + build-essential git curl libcurl3 libcurl3-dev zip \ + libmcrypt-dev libsqlite3-dev libsqlite3-0 mysql-client \ + zlib1g-dev libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \ + libapache2-mod-rpaf libpng12-dev \ + && rm -rf /var/lib/apt/lists/* + +# Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Download oracle packages and install OCI8 +RUN curl -o instantclient-basic-linux.x64-19.6.0.0.0dbru.zip https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip \ + && unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip -d /usr/lib/oracle/ \ + && rm instantclient-basic-linux.x64-19.6.0.0.0dbru.zip \ + && curl -o instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip \ + && unzip instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip -d /usr/lib/oracle/ \ + && rm instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip \ + && echo /usr/lib/oracle/instantclient_19_6 > /etc/ld.so.conf.d/oracle-instantclient.conf \ + && ldconfig + +ENV LD_LIBRARY_PATH=/usr/lib/oracle/instantclient_19_6 + +# PHP5 Extensions +RUN docker-php-ext-install curl \ + && docker-php-ext-install tokenizer \ + && docker-php-ext-install json \ + && docker-php-ext-install bcmath \ + && docker-php-ext-install mcrypt \ + && docker-php-ext-install pdo_mysql \ + && docker-php-ext-install pdo_sqlite \ + && docker-php-ext-install mysql \ + && docker-php-ext-install mysqli \ + && docker-php-ext-install zip \ + && docker-php-ext-install intl \ + && docker-php-ext-install mbstring + +RUN docker-php-ext-configure oci8 --with-oci8=instantclient,/usr/lib/oracle/instantclient_19_6 \ + && docker-php-ext-install oci8 + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ + && docker-php-ext-install gd + +RUN pecl install xdebug-2.4.0RC4 && docker-php-ext-enable xdebug \ + && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini + +RUN apt-get -y --allow-unauthenticated update && apt-get -y --allow-unauthenticated install libaio1 libaio-dev \ + && rm -rf /var/lib/apt/lists/* + +# Insure an SSL directory exists +RUN mkdir -p /etc/apache2/ssl + +# Enable SSL support +RUN a2enmod ssl && a2enmod rewrite + +# Enable apache modules +RUN a2enmod rewrite headers +RUN a2enmod rewrite rpaf + +EXPOSE 80 +EXPOSE 443 + +# ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] diff --git a/bin/php56-oci/Dockerfile b/bin/php56-oci/Dockerfile new file mode 100644 index 0000000000..6121e33a94 --- /dev/null +++ b/bin/php56-oci/Dockerfile @@ -0,0 +1,70 @@ +FROM php:5.6-apache + +# Backup and clean source.list file +RUN cp /etc/apt/sources.list /etc/apt/sources.list.old && \ + cat /dev/null > /etc/apt/sources.list + +# Fix the source.list for stretch +RUN printf "deb http://archive.debian.org/debian/ stretch main\n" > /etc/apt/sources.list && \ + printf "deb-src http://archive.debian.org/debian/ stretch main\n" >> /etc/apt/sources.list && \ + printf "deb http://archive.debian.org/debian-security stretch/updates main\n" >> /etc/apt/sources.list && \ + printf "deb-src http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list + +RUN apt-get -y update && apt-get upgrade -y + +# Install tools && libraries +RUN apt-get -y install --fix-missing nano wget dialog \ + build-essential git curl libcurl3 libcurl3-dev zip \ + libmcrypt-dev libsqlite3-dev libsqlite3-0 mysql-client \ + zlib1g-dev libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \ + libaio1 libaio-dev \ + && rm -rf /var/lib/apt/lists/* + +# Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# Download oracle packages and install OCI8 +RUN curl -o instantclient-basic-linux.x64-19.6.0.0.0dbru.zip https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip \ + && unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip -d /usr/lib/oracle/ \ + && rm instantclient-basic-linux.x64-19.6.0.0.0dbru.zip \ + && curl -o instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip \ + && unzip instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip -d /usr/lib/oracle/ \ + && rm instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip \ + && echo /usr/lib/oracle/instantclient_19_6 > /etc/ld.so.conf.d/oracle-instantclient.conf \ + && ldconfig + +ENV LD_LIBRARY_PATH=/usr/lib/oracle/instantclient_19_6 + +# PHP5 Extensions +RUN docker-php-ext-install curl \ + && docker-php-ext-install tokenizer \ + && docker-php-ext-install json \ + && docker-php-ext-install bcmath \ + && docker-php-ext-install mcrypt \ + && docker-php-ext-install pdo_mysql \ + && docker-php-ext-install pdo_sqlite \ + && docker-php-ext-install mysqli \ + && docker-php-ext-install zip \ + && docker-php-ext-install -j$(nproc) intl \ + && docker-php-ext-install mbstring \ + && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ + && docker-php-ext-install -j$(nproc) gd \ + && pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug \ + && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini + +RUN docker-php-ext-configure oci8 --with-oci8=instantclient,/usr/lib/oracle/instantclient_19_6 \ + && docker-php-ext-install oci8 + +# Insure an SSL directory exists +RUN mkdir -p /etc/apache2/ssl + +# Enable SSL support +RUN a2enmod ssl && a2enmod rewrite + +# Enable apache modules +RUN a2enmod rewrite headers + +EXPOSE 80 +EXPOSE 443 + +ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] diff --git a/bin/php73/Dockerfile b/bin/php73/Dockerfile index 1ca1c88be9..885a091dcc 100644 --- a/bin/php73/Dockerfile +++ b/bin/php73/Dockerfile @@ -1,18 +1,10 @@ -FROM php:7.3-apache-stretch +FROM php:7.3.33-apache-buster # Surpresses debconf complaints of trying to install apt packages interactively # https://github.com/moby/moby/issues/4032#issuecomment-192327844 ARG DEBIAN_FRONTEND=noninteractive -# Remove the old sources.list file. -RUN rm /etc/apt/sources.list - -# Fix the source.list for stretch -RUN printf "deb http://archive.debian.org/debian/ stretch main\n" > /etc/apt/sources.list && \ - printf "deb-src http://archive.debian.org/debian/ stretch main\n" >> /etc/apt/sources.list && \ - printf "deb http://archive.debian.org/debian-security stretch/updates main\n" >> /etc/apt/sources.list && \ - printf "deb-src http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list # Update RUN apt-get -y update --fix-missing && \ @@ -20,24 +12,52 @@ RUN apt-get -y update --fix-missing && \ apt-get --no-install-recommends install -y apt-utils && \ rm -rf /var/lib/apt/lists/* - # Install useful tools and install important libaries RUN apt-get -y update && \ - apt-get -y --no-install-recommends install nano wget dialog libsqlite3-dev libsqlite3-0 && \ - apt-get -y --no-install-recommends install mysql-client zlib1g-dev libzip-dev libicu-dev && \ - apt-get -y --no-install-recommends install --fix-missing apt-utils build-essential git curl && \ - apt-get -y --no-install-recommends install --fix-missing libcurl3 libcurl3-dev zip openssl && \ - rm -rf /var/lib/apt/lists/* && \ - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +apt-get -y --no-install-recommends install nano wget \ +dialog \ +libsqlite3-dev \ +libsqlite3-0 && \ +apt-get -y --no-install-recommends install default-mysql-client \ +zlib1g-dev \ +libzip-dev \ +libicu-dev && \ +apt-get -y --no-install-recommends install --fix-missing apt-utils \ +build-essential \ +git \ +curl \ +libonig-dev && \ +apt-get install -y iputils-ping && \ +apt-get -y --no-install-recommends install --fix-missing libcurl4 \ +libcurl4-openssl-dev \ +zip \ +openssl && \ +rm -rf /var/lib/apt/lists/* && \ +curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + # Install xdebug -RUN pecl install xdebug-2.7.2 && \ - docker-php-ext-enable xdebug +RUN pecl install xdebug-3.1.4 && \ + docker-php-ext-enable xdebug && \ + mkdir /var/log/xdebug # Install redis -RUN pecl install redis-5.0.2 && \ +RUN pecl install redis-5.1.1 && \ docker-php-ext-enable redis +# Install imagick +RUN apt-get update && \ + apt-get -y --no-install-recommends install --fix-missing libmagickwand-dev && \ + rm -rf /var/lib/apt/lists/* && \ + pecl install imagick && \ + docker-php-ext-enable imagick + +# Install mcrypt +RUN apt-get -y update && \ + apt-get install -y libmcrypt-dev && \ + rm -rf /var/lib/apt/lists/* && \ + pecl install mcrypt-1.0.4 && docker-php-ext-enable mcrypt + # Other PHP7 Extensions RUN docker-php-ext-install pdo_mysql && \ @@ -50,14 +70,21 @@ RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install zip && \ docker-php-ext-install -j$(nproc) intl && \ docker-php-ext-install mbstring && \ - docker-php-ext-install gettext + docker-php-ext-install gettext && \ + docker-php-ext-install calendar && \ + docker-php-ext-install exif # Install Freetype RUN apt-get -y update && \ - apt-get --no-install-recommends install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && \ - rm -rf /var/lib/apt/lists/* && \ - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ - docker-php-ext-install -j$(nproc) gd + apt-get --no-install-recommends install -y libfreetype6-dev \ +libjpeg62-turbo-dev \ +libpng-dev && \ + rm -rf /var/lib/apt/lists/* + +RUN docker-php-ext-configure gd \ + --with-png-dir=/usr/include/ \ + --with-jpeg-dir=/usr/include/ \ + --with-freetype-dir=/usr/include/ # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php74/Dockerfile b/bin/php74/Dockerfile index f8b7d99e8b..4ec57b2320 100644 --- a/bin/php74/Dockerfile +++ b/bin/php74/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.4.2-apache-buster +FROM php:7.4.33-apache-buster # Surpresses debconf complaints of trying to install apt packages interactively # https://github.com/moby/moby/issues/4032#issuecomment-192327844 @@ -51,6 +51,12 @@ RUN apt-get update && \ pecl install imagick && \ docker-php-ext-enable imagick +# Install mcrypt +RUN apt-get -y update && \ + apt-get install -y libmcrypt-dev && \ + rm -rf /var/lib/apt/lists/* && \ + pecl install mcrypt-1.0.4 && docker-php-ext-enable mcrypt + # Other PHP7 Extensions RUN docker-php-ext-install pdo_mysql && \ diff --git a/bin/php8/Dockerfile b/bin/php8/Dockerfile index fc76afb609..fdc4805367 100644 --- a/bin/php8/Dockerfile +++ b/bin/php8/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.0.19-apache-buster +FROM php:8.0.27-apache-buster # Surpresses debconf complaints of trying to install apt packages interactively # https://github.com/moby/moby/issues/4032#issuecomment-192327844 diff --git a/bin/php81/Dockerfile b/bin/php81/Dockerfile index aa7f3508ff..4f5b9dad44 100644 --- a/bin/php81/Dockerfile +++ b/bin/php81/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-apache-buster +FROM php:8.1.20-apache-buster # Surpresses debconf complaints of trying to install apt packages interactively # https://github.com/moby/moby/issues/4032#issuecomment-192327844 diff --git a/bin/php82/Dockerfile b/bin/php82/Dockerfile index d14be2de3b..8d4a789475 100644 --- a/bin/php82/Dockerfile +++ b/bin/php82/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.2.1-apache-buster +FROM php:8.2.8-apache-bullseye # Surpresses debconf complaints of trying to install apt packages interactively # https://github.com/moby/moby/issues/4032#issuecomment-192327844 @@ -36,13 +36,18 @@ openssl && \ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Install xdebug -RUN pecl install xdebug-3.2.1 && \ +RUN pecl install xdebug && \ docker-php-ext-enable xdebug && \ mkdir /var/log/xdebug # Install redis -RUN pecl install redis-5.3.7 && \ +RUN pecl install redis && \ docker-php-ext-enable redis + +# Install memcached +RUN apt-get update && apt-get install -y libmemcached-dev libssl-dev zlib1g-dev \ + && pecl install memcached-3.2.0 \ + && docker-php-ext-enable memcached # Install imagick RUN apt-get update && \ @@ -80,6 +85,25 @@ RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install calendar && \ docker-php-ext-install exif +# Install Node JS +#RUN apt-get update && \ +# apt-get install -yq --no-install-recommends \ +# open-ssl \ +# curl \ +# wget \ +# git \ +# gnupg \ +# # more stuff + +#RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \ +# apt-get install -y nodejs npm unzip \ +# build-essential && \ +# node --version && \ +# npm --version + +RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - +RUN apt install nodejs + # Install Freetype RUN apt-get -y update && \ diff --git a/bin/php83/Dockerfile b/bin/php83/Dockerfile index 6ff6a7cbc5..2911db27c8 100644 --- a/bin/php83/Dockerfile +++ b/bin/php83/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3-apache-bookworm +FROM php:8.3.11-apache-bullseye # Surpresses debconf complaints of trying to install apt packages interactively # https://github.com/moby/moby/issues/4032#issuecomment-192327844 @@ -79,6 +79,9 @@ RUN docker-php-ext-install pdo_mysql && \ docker-php-ext-install calendar && \ docker-php-ext-install exif +# postgress pdo + +RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql # Install Freetype RUN apt-get -y update && \ diff --git a/build_container.sh b/build_container.sh new file mode 100644 index 0000000000..f9d8fa0e83 --- /dev/null +++ b/build_container.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker-compose build webserver + diff --git a/config/php/php.ini b/config/php/php.ini index d38c9cb033..5283ac4639 100644 --- a/config/php/php.ini +++ b/config/php/php.ini @@ -1,6 +1,6 @@ -memory_limit = 256M -post_max_size = 100M -upload_max_filesize = 100M +memory_limit = 512M +post_max_size = 512M +upload_max_filesize = 512M # Xdebug 2 #xdebug.remote_enable=1 @@ -14,4 +14,4 @@ upload_max_filesize = 100M #xdebug.start_with_request=yes #xdebug.client_host=host.docker.internal #xdebug.client_port=9003 -#xdebug.idekey=VSCODE \ No newline at end of file +#xdebug.idekey=VSCODE diff --git a/data/crond/.gitkeep b/data/crond/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data/crond/crond b/data/crond/crond new file mode 100644 index 0000000000..de762b78d4 --- /dev/null +++ b/data/crond/crond @@ -0,0 +1 @@ +* * * * 10 curl http://webserver/ > /dev/null \ No newline at end of file diff --git a/docker-compose-build.yml b/docker-compose-build.yml new file mode 100644 index 0000000000..3fd8c5402e --- /dev/null +++ b/docker-compose-build.yml @@ -0,0 +1,90 @@ +version: "3" + +services: + webserver: + build: + context: ./bin/${PHPVERSION} + container_name: "${COMPOSE_PROJECT_NAME}-${PHPVERSION}" + restart: "always" + ports: + - "${HOST_MACHINE_UNSECURE_HOST_PORT}:80" + # - "${HOST_MACHINE_SECURE_HOST_PORT}:443" + links: + - database + volumes: + - ${DOCUMENT_ROOT-./www}:/var/www/html:rw + - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini + - ${SSL_DIR-./config/ssl}:/etc/apache2/ssl/ + - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled + - ${LOG_DIR-./logs/apache2}:/var/log/apache2 + - ${XDEBUG_LOG_DIR-./logs/xdebug}:/var/log/xdebug + environment: + APACHE_DOCUMENT_ROOT: ${APACHE_DOCUMENT_ROOT-/var/www/html} + PMA_PORT: ${HOST_MACHINE_PMA_PORT} + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_USER: ${MYSQL_USER} + MYSQL_PASSWORD: ${MYSQL_PASSWORD} + MYSQL_DATABASE: ${MYSQL_DATABASE} + HOST_MACHINE_MYSQL_PORT: ${HOST_MACHINE_MYSQL_PORT} + XDEBUG_CONFIG: "client_host=host.docker.internal remote_port=${XDEBUG_PORT}" + extra_hosts: + - "host.docker.internal:host-gateway" + database: + build: + context: "./bin/${DATABASE}" + container_name: "${COMPOSE_PROJECT_NAME}-${DATABASE}" + restart: "always" + ports: + - "127.0.0.1:${HOST_MACHINE_MYSQL_PORT}:3306" + volumes: + - ${MYSQL_INITDB_DIR-./config/initdb}:/docker-entrypoint-initdb.d + # - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql + - database:/var/lib/mysql + - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql + environment: + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_DATABASE: ${MYSQL_DATABASE} + MYSQL_USER: ${MYSQL_USER} + MYSQL_PASSWORD: ${MYSQL_PASSWORD} + phpmyadmin: + image: phpmyadmin + container_name: "${COMPOSE_PROJECT_NAME}-phpmyadmin" + links: + - database + environment: + PMA_HOST: database + PMA_PORT: 3306 + # PMA_USER: root + # PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_USER: ${MYSQL_USER} + MYSQL_PASSWORD: ${MYSQL_PASSWORD} + UPLOAD_LIMIT: ${UPLOAD_LIMIT} + MEMORY_LIMIT: ${MEMORY_LIMIT} + ports: + - "${HOST_MACHINE_PMA_PORT}:80" + volumes: + - phpmyadmin:/sessions + - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/conf.d/php-phpmyadmin.ini + redis: + container_name: "${COMPOSE_PROJECT_NAME}-redis" + image: redis:latest + volumes: + - redis:/data + ports: + - "127.0.0.1:${HOST_MACHINE_REDIS_PORT}:6379" + crond: + container_name: "${COMPOSE_PROJECT_NAME}-crond" + build: + context: ./bin/crond + volumes: + - ./data/crond/crond:/etc/crontabs/root + - ./data/crond/log:/var/log/ + +volumes: + database: + name: ${DATABASE} + redis: + name: redis-${COMPOSE_PROJECT_NAME} + phpmyadmin: + name: phpmyadmin-sess-${COMPOSE_PROJECT_NAME} diff --git a/docker-compose.yml b/docker-compose.yml index 4cb90d0d16..80e06e6c1b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,11 @@ version: "3" - + services: webserver: - build: - context: ./bin/${PHPVERSION} - container_name: "${COMPOSE_PROJECT_NAME}-${PHPVERSION}" + image: tjipenk/webserver:${PHPVERSION} restart: "always" ports: - "${HOST_MACHINE_UNSECURE_HOST_PORT}:80" - - "${HOST_MACHINE_SECURE_HOST_PORT}:443" links: - database volumes: @@ -29,16 +26,17 @@ services: XDEBUG_CONFIG: "client_host=host.docker.internal remote_port=${XDEBUG_PORT}" extra_hosts: - "host.docker.internal:host-gateway" + user: www-data database: - build: - context: "./bin/${DATABASE}" + image: mariadb:lts container_name: "${COMPOSE_PROJECT_NAME}-${DATABASE}" restart: "always" ports: - "127.0.0.1:${HOST_MACHINE_MYSQL_PORT}:3306" volumes: - ${MYSQL_INITDB_DIR-./config/initdb}:/docker-entrypoint-initdb.d - - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql + # - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql + - database:/var/lib/mysql - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} @@ -46,15 +44,15 @@ services: MYSQL_USER: ${MYSQL_USER} MYSQL_PASSWORD: ${MYSQL_PASSWORD} phpmyadmin: - image: phpmyadmin + image: phpmyadmin:fpm container_name: "${COMPOSE_PROJECT_NAME}-phpmyadmin" links: - database environment: PMA_HOST: database PMA_PORT: 3306 - PMA_USER: root - PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD} + # PMA_USER: root + # PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_USER: ${MYSQL_USER} MYSQL_PASSWORD: ${MYSQL_PASSWORD} @@ -62,12 +60,29 @@ services: MEMORY_LIMIT: ${MEMORY_LIMIT} ports: - "${HOST_MACHINE_PMA_PORT}:80" - - "${HOST_MACHINE_PMA_SECURE_PORT}:443" volumes: - - /sessions + - phpmyadmin:/sessions - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/conf.d/php-phpmyadmin.ini redis: container_name: "${COMPOSE_PROJECT_NAME}-redis" image: redis:latest + volumes: + - redis:/data ports: - "127.0.0.1:${HOST_MACHINE_REDIS_PORT}:6379" + crond: + container_name: "${COMPOSE_PROJECT_NAME}-crond" + user: www-data + build: + context: ./bin/crond + volumes: + - ./data/crond/crond:/etc/crontabs/root + - ./data/crond/log:/var/log/ + +volumes: + database: + name: ${DATABASE} + redis: + name: redis-${COMPOSE_PROJECT_NAME} + phpmyadmin: + name: phpmyadmin-sess-${COMPOSE_PROJECT_NAME} diff --git a/sample.env b/sample.env index e1df9da174..9eb6f1e455 100644 --- a/sample.env +++ b/sample.env @@ -1,11 +1,13 @@ # Please Note: # In PHP Versions <= 7.4 MySQL8 is not supported due to lacking pdo support - +## oke # To determine the name of your containers COMPOSE_PROJECT_NAME=lamp + # Possible values: php54, php56, php71, php72, php73, php74, php8, php81, php82, php83 PHPVERSION=php83 + DOCUMENT_ROOT=./www APACHE_DOCUMENT_ROOT=/var/www/html VHOSTS_DIR=./config/vhosts @@ -27,23 +29,24 @@ XDEBUG_PORT=9003 # For Apple Silicon User: # Please select Mariadb as Database. Oracle doesn't build their SQL Containers for the arm Architecure -DATABASE=mysql8 +DATABASE=mariadb104 MYSQL_INITDB_DIR=./config/initdb -MYSQL_DATA_DIR=./data/mysql +## database volumes +#MYSQL_DATA_DIR=./data/mysql MYSQL_LOG_DIR=./logs/mysql # If you already have the port 80 in use, you can change it (for example if you have Apache) HOST_MACHINE_UNSECURE_HOST_PORT=80 # If you already have the port 443 in use, you can change it (for example if you have Apache) -HOST_MACHINE_SECURE_HOST_PORT=443 +# HOST_MACHINE_SECURE_HOST_PORT=443 # If you already have the port 3306 in use, you can change it (for example if you have MySQL) HOST_MACHINE_MYSQL_PORT=3306 # If you already have the port 8080 in use, you can change it (for example if you have PMA) HOST_MACHINE_PMA_PORT=8080 -HOST_MACHINE_PMA_SECURE_PORT=8443 +# HOST_MACHINE_PMA_SECURE_PORT=8443 # If you already has the port 6379 in use, you can change it (for example if you have Redis) HOST_MACHINE_REDIS_PORT=6379