From 51b046b30d9f2e4c904c7ebec754b836f3f25703 Mon Sep 17 00:00:00 2001 From: Muhamad Aditya Prima Date: Fri, 13 Dec 2024 19:43:33 +0700 Subject: [PATCH] Added ubi9 based image --- .gitea/workflows/alpine-dockerio.yaml | 2 +- .gitea/workflows/alpine-winter.yaml | 2 +- .gitea/workflows/ubi9-dockerio.yaml | 95 +++++++++++++++++++++++++++ .gitea/workflows/ubi9-winter.yaml | 95 +++++++++++++++++++++++++++ Dockerfile.alpine | 8 +-- Dockerfile.ubi9 | 48 ++++++++++++++ Dockerfile.ubi9-micro | 9 +++ 7 files changed, 252 insertions(+), 7 deletions(-) create mode 100644 .gitea/workflows/ubi9-dockerio.yaml create mode 100644 .gitea/workflows/ubi9-winter.yaml create mode 100644 Dockerfile.ubi9 create mode 100644 Dockerfile.ubi9-micro diff --git a/.gitea/workflows/alpine-dockerio.yaml b/.gitea/workflows/alpine-dockerio.yaml index 6e2029e..f752b5d 100644 --- a/.gitea/workflows/alpine-dockerio.yaml +++ b/.gitea/workflows/alpine-dockerio.yaml @@ -77,7 +77,7 @@ jobs: PHP_VERSION=8.0 push: true tags: | - aprimediet/composer:2.8.0-php8.0-alpine + aprimediet/composer:2.8.4-php8.0-alpine aprimediet/composer:2.8-php8.0-alpine - name: Build and push 2.8 on php8.1 uses: docker/build-push-action@v5 diff --git a/.gitea/workflows/alpine-winter.yaml b/.gitea/workflows/alpine-winter.yaml index d30d783..1b5e34c 100644 --- a/.gitea/workflows/alpine-winter.yaml +++ b/.gitea/workflows/alpine-winter.yaml @@ -77,7 +77,7 @@ jobs: PHP_VERSION=8.0 push: true tags: | - git.winteraccess.id/${{ gitea.repository }}:2.8.0-php8.0-alpine + git.winteraccess.id/${{ gitea.repository }}:2.8.4-php8.0-alpine git.winteraccess.id/${{ gitea.repository }}:2.8-php8.0-alpine - name: Build and push 2.8 on php8.1 uses: docker/build-push-action@v5 diff --git a/.gitea/workflows/ubi9-dockerio.yaml b/.gitea/workflows/ubi9-dockerio.yaml new file mode 100644 index 0000000..90909d7 --- /dev/null +++ b/.gitea/workflows/ubi9-dockerio.yaml @@ -0,0 +1,95 @@ +name: Build and Push UBI9 based Composer Image +on: + push: + branches: + - master + +jobs: + build: + name: Build and push composer on ubi9 based 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 Registry + uses: docker/login-action@v3 + with: + registry: docker.io + username: aprimediet + password: ${{ secrets.DOCKER_TOKEN }} + - name: Build and push 2.8 on php7.4 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=7.4 + push: true + tags: | + aprimediet/composer:2.8.4-php7.4-ubi9 + aprimediet/composer:2.8-php7.4-ubi9 + - name: Build and push 2.8 on php8.0 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.0 + push: true + tags: | + aprimediet/composer:2.8.4-php8.0-ubi9 + aprimediet/composer:2.8-php8.0-ubi9 + - name: Build and push 2.8 on php8.1 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.1 + push: true + tags: | + aprimediet/composer:2.8.4-php8.1-ubi9 + aprimediet/composer:2.8-php8.1-ubi9 + - name: Build and push 2.8 on php8.2 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.2 + push: true + tags: | + aprimediet/composer:2.8.4-php8.2-ubi9 + aprimediet/composer:2.8-php8.2-ubi9 + - name: Build and push 2.8 on php8.3 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.3 + push: true + tags: | + aprimediet/composer:2.8.4-php8.3-ubi9 + aprimediet/composer:2.8-php8.3-ubi9 + - name: Build and push 2.8 on php8.4 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.4 + push: true + tags: | + aprimediet/composer:2.8.4-php8.4-ubi9 + aprimediet/composer:2.8-php8.4-ubi9 + aprimediet/composer:2.8-ubi9 + aprimediet/composer:ubi9 \ No newline at end of file diff --git a/.gitea/workflows/ubi9-winter.yaml b/.gitea/workflows/ubi9-winter.yaml new file mode 100644 index 0000000..8887f2a --- /dev/null +++ b/.gitea/workflows/ubi9-winter.yaml @@ -0,0 +1,95 @@ +name: Build and Push UBI9 based Composer Image +on: + push: + branches: + - master + +jobs: + build: + name: Build and push composer on ubi9 based 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 Registry + uses: docker/login-action@v3 + with: + registry: git.winteraccess.id + username: ${{ vars.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build and push 2.8 on php7.4 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=7.4 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:2.8.4-php7.4-ubi9 + git.winteraccess.id/${{ gitea.repository }}:2.8-php7.4-ubi9 + - name: Build and push 2.8 on php8.0 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.0 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:2.8.4-php8.0-ubi9 + git.winteraccess.id/${{ gitea.repository }}:2.8-php8.0-ubi9 + - name: Build and push 2.8 on php8.1 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.1 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:2.8.4-php8.1-ubi9 + git.winteraccess.id/${{ gitea.repository }}:2.8-php8.1-ubi9 + - name: Build and push 2.8 on php8.2 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.2 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:2.8.4-php8.2-ubi9 + git.winteraccess.id/${{ gitea.repository }}:2.8-php8.2-ubi9 + - name: Build and push 2.8 on php8.3 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.3 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:2.8.4-php8.3-ubi9 + git.winteraccess.id/${{ gitea.repository }}:2.8-php8.3-ubi9 + - name: Build and push 2.8 on php8.4 + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ubi9 + build-args: | + COMPOSER_VERSION=2.8.4 + PHP_VERSION=8.4 + push: true + tags: | + git.winteraccess.id/${{ gitea.repository }}:2.8.4-php8.4-ubi9 + git.winteraccess.id/${{ gitea.repository }}:2.8-php8.4-ubi9 + git.winteraccess.id/${{ gitea.repository }}:2.8-ubi9 + git.winteraccess.id/${{ gitea.repository }}:ubi9 \ No newline at end of file diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 0d9fa47..0881ff8 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -14,12 +14,10 @@ WORKDIR /tmp ENV COMPOSER_HOME=/usr/local/share/composer ENV COMPOSER_CACHE_DIR=${COMPOSER_HOME}/cache -# Setup composer user +# Setup composer user and required directories RUN addgroup -g 10001 composer && \ adduser -D -u 10001 -G composer -s /bin/sh -h /build composer - -# CREATE CACHES DIR FOR COMPOSER -RUN mkdir -p ${COMPOSER_CACHE_DIR}/files && \ + mkdir -p ${COMPOSER_CACHE_DIR}/files && \ mkdir -p ${COMPOSER_CACHE_DIR}/repo && \ mkdir -p ${COMPOSER_CACHE_DIR}/vcs && \ chown -R composer:composer ${COMPOSER_CACHE_DIR} @@ -27,7 +25,7 @@ RUN mkdir -p ${COMPOSER_CACHE_DIR}/files && \ # ADD apk repository RUN printf "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing\n" >> /etc/apk/repositories -# Update & Upgrade first +# Add all php extensions RUN --mount=type=cache,target=/var/cache/apk \ apk update && apk upgrade && apk add git \ php${PHP_VERSION}-bcmath php${PHP_VERSION}-bz2 \ diff --git a/Dockerfile.ubi9 b/Dockerfile.ubi9 new file mode 100644 index 0000000..6933161 --- /dev/null +++ b/Dockerfile.ubi9 @@ -0,0 +1,48 @@ +ARG REGISTRY_URL=docker.io/aprimediet +ARG PHP_VERSION=8.4 + +FROM ${REGISTRY_URL}/php:${PHP_VERSION}-ubi9 +LABEL maintainer=" aprimediet@gmail.com" + +ARG COMPOSER_VERSION=2.8.4 + +USER root + +WORKDIR /tmp + +# Set composer home +ENV COMPOSER_HOME=/usr/local/share/composer +ENV COMPOSER_CACHE_DIR=${COMPOSER_HOME}/cache + +# Setup composer user and required directories +RUN groupadd -g 10001 composer && \ + useradd -u 10001 -g 10001 -m -d /build -s /sbin/nologin composer && \ + mkdir -p ${COMPOSER_CACHE_DIR}/files && \ + mkdir -p ${COMPOSER_CACHE_DIR}/repo && \ + mkdir -p ${COMPOSER_CACHE_DIR}/vcs && \ + chown -R composer:composer ${COMPOSER_CACHE_DIR} + +# Add all php extensions +RUN dnf -y update && dnf -y install \ + php-bcmath php-brotli php-dba php-dbg php-devel \ + php-embedded php-enchant php-ffi php-geos php-gmp \ + php-intl php-json php-ldap php-lz4 \ + php-maxminddb php-mysqlnd php-odbc \ + php-opcache php-pdo php-pdo-dblib php-pdo-firebird \ + php-pear php-pgsql php-phpiredis php-process \ + php-snmp php-soap php-sodium \ + php-tidy php-xz php-zstd + +# Download and install composer +ADD https://getcomposer.org/installer ./composer-setup.php +RUN php composer-setup.php --version=${COMPOSER_VERSION} && \ + mv composer.phar /usr/local/bin/composer && \ + rm -f ./composer-setup.php && \ + dnf -y autoremove && \ + dnf -y clean all + +USER composer + +WORKDIR /build + +CMD ["/usr/local/bin/composer"] \ No newline at end of file diff --git a/Dockerfile.ubi9-micro b/Dockerfile.ubi9-micro new file mode 100644 index 0000000..334adee --- /dev/null +++ b/Dockerfile.ubi9-micro @@ -0,0 +1,9 @@ +ARG REGISTRY_URL=docker.io/aprimediet +ARG PHP_VERSION=8.4 +ARG COMPOSER_VERSION=2.8.4 + +FROM ${REGISTRY_URL}/php:${PHP_VERSION}-apache-ubi9 AS builder +LABEL maintainer=" aprimediet@gmail.com" + +FROM ${REGISTRY_URL}/composer:${PHP_VERSION}-ubi9-micro AS runtime +LABEL maintainer=" aprimediet@gmail.com" \ No newline at end of file