Added ubuntu gitea workflow

This commit is contained in:
Aditya Prima 2024-03-23 20:30:23 +07:00
parent 7271e38e5b
commit 7224451646
5 changed files with 224 additions and 26 deletions

View File

@ -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

42
Dockerfile.ubuntu Normal file
View File

@ -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="<Muhamad Aditya Prima> 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

View File

@ -16,15 +16,11 @@ ARG ALPINE_PHP_VERSION=81
# INSTALL PACKAGES AND IGNORE ERRORS WHEN OCURRED # INSTALL PACKAGES AND IGNORE ERRORS WHEN OCURRED
RUN --mount=type=cache,target=/var/cache/apk \ RUN --mount=type=cache,target=/var/cache/apk \
apk add --update \ apk add --update \
php${PHP_VERSION}-mysqli; exit 0 php${PHP_VERSION}-pgsql; exit 0
RUN --mount=type=cache,target=/var/cache/apk \ RUN --mount=type=cache,target=/var/cache/apk \
apk add --update \ apk add --update \
php${PHP_VERSION}-mysqlnd; exit 0 php${PHP_VERSION}-pdo php${PHP_VERSION}-pdo_pgsql; exit 0
RUN --mount=type=cache,target=/var/cache/apk \
apk add --update \
php${PHP_VERSION}-pdo php${PHP_VERSION}-pdo_mysql; exit 0
# CLEAN APK CACHES # CLEAN APK CACHES
RUN rm -vrf /var/cache/apk/* RUN rm -vrf /var/cache/apk/*

View File

@ -10,8 +10,7 @@ ENV PHP_FPM_BIN=php-fpm${PHP_VERSION}
WORKDIR /root WORKDIR /root
RUN --mount=type=cache,target=/var/cache/apt/archives \ RUN apt -y update && apt -y upgrade && apt -y install \
apt -y update && apt -y upgrade && apt -y install \
software-properties-common software-properties-common
# ADD PPA TO INSTALL MULTIPLE PHP VERSIONS # ADD PPA TO INSTALL MULTIPLE PHP VERSIONS
@ -20,26 +19,18 @@ RUN add-apt-repository ppa:ondrej/php && apt -y update
# INSTALL BASE DEPENDENCIES # INSTALL BASE DEPENDENCIES
RUN --mount=type=cache,target=/var/cache/apt/archives \ RUN --mount=type=cache,target=/var/cache/apt/archives \
apt -y install \ apt -y install \
php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-common \ 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
# INSTALL PACKAGES AND IGNORE ERRORS WHEN OCURRED # INSTALL PACKAGES AND IGNORE ERRORS WHEN OCURRED
RUN --mount=type=cache,target=/var/cache/apt/archives \ # RUN --mount=type=cache,target=/var/cache/apt/archives \
apt -y install \ # apt -y install \
php${PHP_VERSION}-autoload php${PHP_VERSION}-date php${PHP_VERSION}-monolog \ # php${PHP_VERSION}-autoload php${PHP_VERSION}-date php${PHP_VERSION}-monolog \
php${PHP_VERSION}-psr; exit 0 # php${PHP_VERSION}-psr; exit 0
# FAILING ON PHP-8.0 # FAILING ON PHP-8.0
RUN --mount=type=cache,target=/var/cache/apt/archives \ # RUN --mount=type=cache,target=/var/cache/apt/archives \
apt -y install \ # apt -y install \
php${PHP_VERSION}-json; exit 0 # php${PHP_VERSION}-json; exit 0
# REMOVE CURRENT POOL FIRST # REMOVE CURRENT POOL FIRST
RUN rm -rf /etc/php/${PHP_VERSION}/fpm/pool.d 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 RUN ln -ns /usr/bin/php${PHP_VERSION} /usr/bin/php; exit 0
# DOWNLOAD AND INSTALL COMPOSER # DOWNLOAD AND INSTALL COMPOSER
ADD https://getcomposer.org/installer ./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 # RUN php composer-setup.php && mv composer.phar /usr/local/bin/composer && rm -f ./composer-setup.php
# CHANGE USER PERMISSION ON /etc/services.d # CHANGE USER PERMISSION ON /etc/services.d
RUN chmod -R +x /etc/services.d/php-fpm/* RUN chmod -R +x /etc/services.d/php-fpm/*

View File

@ -0,0 +1,59 @@
ARG UBUNTU_VERSION=latest
FROM aprimediet/ubuntu:${UBUNTU_VERSION}
LABEL maintainer="<Muhamad Aditya Prima> 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