diff --git a/.gitea/workflows/ubuntu.yaml b/.gitea/workflows/ubuntu.yaml new file mode 100644 index 0000000..92fbb6d --- /dev/null +++ b/.gitea/workflows/ubuntu.yaml @@ -0,0 +1,110 @@ +name: Build and Push Ubuntu Image +on: + push: + branches: + - master + +jobs: + build: + name: Build and push image + runs-on: ubuntu-latest + container: + image: ghcr.io/catthehacker/ubuntu:act-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Login to Docker Winter Access Git Registry + uses: docker/login-action@v3 + with: + registry: git.winteraccess.id + username: aditya.prima + password: ${{ secrets.PATOKEN }} + - name: Build and push 5.6 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=5.6 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:5.6 + git.winteraccess.id/${{ gitea.repository }}:5.6-ubuntu + - name: Build and push 7.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=7.2 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.2 + git.winteraccess.id/${{ gitea.repository }}:7.2-ubuntu + - name: Build and push 7.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=7.3 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.3 + git.winteraccess.id/${{ gitea.repository }}:7.3-ubuntu + - name: Build and push 7.4 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=7.4 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:7.4 + git.winteraccess.id/${{ gitea.repository }}:7.4-ubuntu + - name: Build and push 8.0 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.0 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.0 + git.winteraccess.id/${{ gitea.repository }}:8.0-ubuntu + - name: Build and push 8.1 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.1 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.1 + git.winteraccess.id/${{ gitea.repository }}:8.1-ubuntu + - name: Build and push 8.2 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.2 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.2 + git.winteraccess.id/${{ gitea.repository }}:8.2-ubuntu + - name: Build and push 8.3 Images + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubuntu + build-args: | + PHP_VERSION=8.3 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:8.3 + git.winteraccess.id/${{ gitea.repository }}:8.3-ubuntu + git.winteraccess.id/${{ gitea.repository }}:latest diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu new file mode 100644 index 0000000..ff4d89b --- /dev/null +++ b/Dockerfile.ubuntu @@ -0,0 +1,42 @@ +ARG PHP_VERSION=8.1 +ARG BASE_REPO=git.winteraccess.id/docker/php + +FROM ${BASE_REPO}:${PHP_VERSION}-ubuntu +LABEL maintainer=" aprimediet@gmail.com" + +ARG PHP_VERSION=8.1 + +ENV PHP_FPM_BIN=php-fpm${PHP_VERSION} + +WORKDIR /root + +# Install PHP FPM +RUN apt -y update && apt -y upgrade && \ + apt -y install \ + php${PHP_VERSION}-fpm + +# REMOVE CURRENT POOL FIRST +RUN rm -rf /etc/php/${PHP_VERSION}/fpm/pool.d + +# COPY CONFIGURATION FILES +ADD ./etc/php/fpm/php-fpm.conf /etc/php/${PHP_VERSION}/fpm/php-fpm.conf +ADD ./etc/php/fpm/pool.d /etc/php/fpm/pool.d +ADD ./etc/services.d/php-fpm /etc/services.d/php-fpm + +# CREATE SYMLINKS TO /usr/bin/php IN CASE IT IS NOT EXISTS +RUN ln -ns /usr/bin/php${PHP_VERSION} /usr/bin/php; exit 0 + +# DOWNLOAD AND INSTALL COMPOSER +# ADD https://getcomposer.org/installer ./composer-setup.php +# RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f ./composer-setup.php + +# CHANGE USER PERMISSION ON /etc/services.d +RUN chmod -R +x /etc/services.d/php-fpm/* + +# CLEAN APT CACHES +RUN apt -y clean + +# CREATE PHP RUN DIRECTORY +RUN mkdir -p /var/run/php && mkdir -p /var/lib/php/session + +EXPOSE 9000 \ No newline at end of file diff --git a/Dockerfile_alpine_pgsql b/Dockerfile_alpine_pgsql index 2162dfb..561a12a 100644 --- a/Dockerfile_alpine_pgsql +++ b/Dockerfile_alpine_pgsql @@ -16,15 +16,11 @@ ARG ALPINE_PHP_VERSION=81 # INSTALL PACKAGES AND IGNORE ERRORS WHEN OCURRED RUN --mount=type=cache,target=/var/cache/apk \ apk add --update \ - php${PHP_VERSION}-mysqli; exit 0 + php${PHP_VERSION}-pgsql; exit 0 RUN --mount=type=cache,target=/var/cache/apk \ apk add --update \ - php${PHP_VERSION}-mysqlnd; exit 0 - -RUN --mount=type=cache,target=/var/cache/apk \ - apk add --update \ - php${PHP_VERSION}-pdo php${PHP_VERSION}-pdo_mysql; exit 0 + php${PHP_VERSION}-pdo php${PHP_VERSION}-pdo_pgsql; exit 0 # CLEAN APK CACHES RUN rm -vrf /var/cache/apk/* diff --git a/Dockerfile_ubuntu b/Dockerfile_ubuntu index c7a1c05..5e71185 100644 --- a/Dockerfile_ubuntu +++ b/Dockerfile_ubuntu @@ -10,8 +10,7 @@ ENV PHP_FPM_BIN=php-fpm${PHP_VERSION} WORKDIR /root -RUN --mount=type=cache,target=/var/cache/apt/archives \ - apt -y update && apt -y upgrade && apt -y install \ +RUN apt -y update && apt -y upgrade && apt -y install \ software-properties-common # ADD PPA TO INSTALL MULTIPLE PHP VERSIONS @@ -20,26 +19,18 @@ RUN add-apt-repository ppa:ondrej/php && apt -y update # INSTALL BASE DEPENDENCIES RUN --mount=type=cache,target=/var/cache/apt/archives \ apt -y install \ - php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-common \ - php${PHP_VERSION}-bcmath php${PHP_VERSION}-bz2 \ - php${PHP_VERSION}-cgi php${PHP_VERSION}-curl \ - php${PHP_VERSION}-dba php${PHP_VERSION}-dev php${PHP_VERSION}-gd \ - php${PHP_VERSION}-imagick php${PHP_VERSION}-intl \ - php${PHP_VERSION}-mbstring php${PHP_VERSION}-memcache \ - php${PHP_VERSION}-memcached php${PHP_VERSION}-pspell \ - php${PHP_VERSION}-readline php${PHP_VERSION}-xml \ - php${PHP_VERSION}-xmlrpc php${PHP_VERSION}-zip + php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-common # INSTALL PACKAGES AND IGNORE ERRORS WHEN OCURRED -RUN --mount=type=cache,target=/var/cache/apt/archives \ - apt -y install \ - php${PHP_VERSION}-autoload php${PHP_VERSION}-date php${PHP_VERSION}-monolog \ - php${PHP_VERSION}-psr; exit 0 +# RUN --mount=type=cache,target=/var/cache/apt/archives \ +# apt -y install \ +# php${PHP_VERSION}-autoload php${PHP_VERSION}-date php${PHP_VERSION}-monolog \ +# php${PHP_VERSION}-psr; exit 0 # FAILING ON PHP-8.0 -RUN --mount=type=cache,target=/var/cache/apt/archives \ - apt -y install \ - php${PHP_VERSION}-json; exit 0 +# RUN --mount=type=cache,target=/var/cache/apt/archives \ +# apt -y install \ +# php${PHP_VERSION}-json; exit 0 # REMOVE CURRENT POOL FIRST RUN rm -rf /etc/php/${PHP_VERSION}/fpm/pool.d @@ -53,8 +44,8 @@ ADD ./etc/services.d/php-fpm /etc/services.d/php-fpm RUN ln -ns /usr/bin/php${PHP_VERSION} /usr/bin/php; exit 0 # DOWNLOAD AND INSTALL COMPOSER -ADD https://getcomposer.org/installer ./composer-setup.php -RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f ./composer-setup.php +# ADD https://getcomposer.org/installer ./composer-setup.php +# RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f ./composer-setup.php # CHANGE USER PERMISSION ON /etc/services.d RUN chmod -R +x /etc/services.d/php-fpm/* diff --git a/Dockerfile_ubuntu_rootless b/Dockerfile_ubuntu_rootless new file mode 100644 index 0000000..5e71185 --- /dev/null +++ b/Dockerfile_ubuntu_rootless @@ -0,0 +1,59 @@ +ARG UBUNTU_VERSION=latest + +FROM aprimediet/ubuntu:${UBUNTU_VERSION} +LABEL maintainer=" aprimediet@gmail.com" + +ARG PHP_VERSION=8.1 + +ENV PHP_VERSION=${PHP_VERSION} +ENV PHP_FPM_BIN=php-fpm${PHP_VERSION} + +WORKDIR /root + +RUN apt -y update && apt -y upgrade && apt -y install \ + software-properties-common + +# ADD PPA TO INSTALL MULTIPLE PHP VERSIONS +RUN add-apt-repository ppa:ondrej/php && apt -y update + +# INSTALL BASE DEPENDENCIES +RUN --mount=type=cache,target=/var/cache/apt/archives \ + apt -y install \ + php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-common + +# INSTALL PACKAGES AND IGNORE ERRORS WHEN OCURRED +# RUN --mount=type=cache,target=/var/cache/apt/archives \ +# apt -y install \ +# php${PHP_VERSION}-autoload php${PHP_VERSION}-date php${PHP_VERSION}-monolog \ +# php${PHP_VERSION}-psr; exit 0 + +# FAILING ON PHP-8.0 +# RUN --mount=type=cache,target=/var/cache/apt/archives \ +# apt -y install \ +# php${PHP_VERSION}-json; exit 0 + +# REMOVE CURRENT POOL FIRST +RUN rm -rf /etc/php/${PHP_VERSION}/fpm/pool.d + +# COPY CONFIGURATION FILES +ADD ./etc/php/fpm/php-fpm.conf /etc/php/${PHP_VERSION}/fpm/php-fpm.conf +ADD ./etc/php/fpm/pool.d /etc/php/fpm/pool.d +ADD ./etc/services.d/php-fpm /etc/services.d/php-fpm + +# CREATE SYMLINKS TO /usr/bin/php IN CASE IT IS NOT EXISTS +RUN ln -ns /usr/bin/php${PHP_VERSION} /usr/bin/php; exit 0 + +# DOWNLOAD AND INSTALL COMPOSER +# ADD https://getcomposer.org/installer ./composer-setup.php +# RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f ./composer-setup.php + +# CHANGE USER PERMISSION ON /etc/services.d +RUN chmod -R +x /etc/services.d/php-fpm/* + +# CLEAN APT CACHES +RUN apt -y clean + +# CREATE PHP RUN DIRECTORY +RUN mkdir -p /var/run/php && mkdir -p /var/lib/php/session + +EXPOSE 9000 \ No newline at end of file