Added ubi9 base image support
Build and Push Alpine PHP Image / Build and push image (push) Successful in 47s Details
Build and Push Alpine PHP Image / Build and push apache image (push) Failing after 18s Details
Build and Push ubi9 PHP Image / Build and push ubi9-micro image (push) Has been cancelled Details
Build and Push ubi9 PHP Image / Build and push ubi9 apache image (push) Has been cancelled Details
Build and Push ubi9 PHP Image / Build and push ubi9 image (push) Has been cancelled Details

This commit is contained in:
Muhamad Aditya Prima 2024-12-13 16:22:42 +07:00
parent 7bb4db0901
commit eef4941edc
8 changed files with 348 additions and 13 deletions

View File

@ -30,6 +30,7 @@ jobs:
push: true
tags: |
aprimediet/php:5.6-alpine
aprimediet/php:5-alpine
- name: Build and push 7.2
uses: docker/build-push-action@v5
with:
@ -63,6 +64,7 @@ jobs:
push: true
tags: |
aprimediet/php:7.4-alpine
aprimediet/php:7-alpine
- name: Build and push 8.0
uses: docker/build-push-action@v5
with:
@ -140,7 +142,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.5
PHP_VERSION=5
@ -148,11 +150,12 @@ jobs:
push: true
tags: |
aprimediet/php:5.6-apache-alpine
aprimediet/php:5-apache-alpine
- name: Build and push 7.2 with Apache2
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.9
PHP_VERSION=7
@ -164,7 +167,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.10
PHP_VERSION=7
@ -176,7 +179,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.13
PHP_VERSION=7
@ -184,11 +187,12 @@ jobs:
push: true
tags: |
aprimediet/php:7.4-apache-alpine
aprimediet/php:7-apache-alpine
- name: Build and push 8.0 with Apache2
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.16
PHP_VERSION=8
@ -200,7 +204,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.18
PHP_VERSION=81
@ -212,7 +216,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.18
PHP_VERSION=82
@ -224,7 +228,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.19
PHP_VERSION=83
@ -236,12 +240,13 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.apache-alpine
file: Dockerfile.alpine-apache
build-args: |
ALPINE_VERSION=3.21
PHP_VERSION=84
PHP=8.4
push: true
tags: |
aprimediet/php:8.4-apache-alpine
aprimediet/php:8-apache-alpine
aprimediet/php:8.4-apache-alpine
aprimediet/php:apache-alpine

View File

@ -31,6 +31,7 @@ jobs:
push: true
tags: |
git.winteraccess.id/${{ gitea.repository }}:5.6-alpine
git.winteraccess.id/${{ gitea.repository }}:5-alpine
- name: Build and push 7.2
uses: docker/build-push-action@v5
with:
@ -67,6 +68,7 @@ jobs:
push: true
tags: |
git.winteraccess.id/${{ gitea.repository }}:7.4-alpine
git.winteraccess.id/${{ gitea.repository }}:7-alpine
- name: Build and push 8.0
uses: docker/build-push-action@v5
with:
@ -126,8 +128,9 @@ jobs:
PHP_VERSION=84
push: true
tags: |
git.winteraccess.id/${{ gitea.repository }}:8-alpine
git.winteraccess.id/${{ gitea.repository }}:8.4-alpine
git.winteraccess.id/${{ gitea.repository }}:8-alpine
git.winteraccess.id/${{ gitea.repository }}:alpine
build-apache:
name: Build and push apache image
runs-on: ubuntu-latest
@ -157,6 +160,7 @@ jobs:
push: true
tags: |
git.winteraccess.id/${{ gitea.repository }}:5.6-apache-alpine
git.winteraccess.id/${{ gitea.repository }}:5-apache-alpine
- name: Build and push 7.2 with Apache2
uses: docker/build-push-action@v5
with:
@ -196,6 +200,7 @@ jobs:
push: true
tags: |
git.winteraccess.id/${{ gitea.repository }}:7.4-apache-alpine
git.winteraccess.id/${{ gitea.repository }}:7-apache-alpine
- name: Build and push 8.0 with Apache2
uses: docker/build-push-action@v5
with:
@ -260,5 +265,6 @@ jobs:
PHP=8.4
push: true
tags: |
git.winteraccess.id/${{ gitea.repository }}:8.4-apache-alpine
git.winteraccess.id/${{ gitea.repository }}:8-apache-alpine
git.winteraccess.id/${{ gitea.repository }}:8.4-apache-alpine
git.winteraccess.id/${{ gitea.repository }}:apache-alpine

View File

@ -159,3 +159,162 @@ jobs:
aprimediet/php:8.4-ubi9-micro
aprimediet/php:8-ubi9-micro
aprimediet/php:ubi9-micro
build-apache:
name: Build and push ubi9 apache image
runs-on: ubuntu-latest
needs:
- build
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 7.4
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-apache
build-args: |
PHP_VERSION=7.4
push: true
tags: |
aprimediet/php:7.4-apache-ubi9
aprimediet/php:7-apache-ubi9
- name: Build and push 8.0
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-apache
build-args: |
PHP_VERSION=8.0
push: true
tags: |
aprimediet/php:8.0-apache-ubi9
- name: Build and push 8.1
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-apache
build-args: |
PHP_VERSION=8.1
push: true
tags: |
aprimediet/php:8.1-apache-ubi9
- name: Build and push 8.2
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-apache
build-args: |
PHP_VERSION=8.2
push: true
tags: |
aprimediet/php:8.2-apache-ubi9
- name: Build and push 8.3
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-apache
build-args: |
PHP_VERSION=8.3
push: true
tags: |
aprimediet/php:8.3-apache-ubi9
- name: Build and push 8.4
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-apache
build-args: |
PHP_VERSION=8.4
push: true
tags: |
aprimediet/php:8.4-apache-ubi9
aprimediet/php:8-apache-ubi9
aprimediet/php:apache-ubi9
build-apache-micro:
name: Build and push ubi9-micro image
runs-on: ubuntu-latest
needs:
- build
- build-micro
- build-apache
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 7.4
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-micro-apache
build-args: |
PHP_VERSION=7.4
push: true
tags: |
aprimediet/php:7.4-apache-ubi9-micro
- name: Build and push 8.0
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-micro-apache
build-args: |
PHP_VERSION=8.0
push: true
tags: |
aprimediet/php:8.0-apache-ubi9-micro
- name: Build and push 8.1
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-micro-apache
build-args: |
PHP_VERSION=8.1
push: true
tags: |
aprimediet/php:8.1-apache-ubi9-micro
- name: Build and push 8.2
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-micro-apache
build-args: |
PHP_VERSION=8.2
push: true
tags: |
aprimediet/php:8.2-apache-ubi9-micro
- name: Build and push 8.3
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-micro-apache
build-args: |
PHP_VERSION=8.3
push: true
tags: |
aprimediet/php:8.3-apache-ubi9-micro
- name: Build and push 8.4
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ubi9-micro-apache
build-args: |
PHP_VERSION=8.4
push: true
tags: |
aprimediet/php:8.4-apache-ubi9-micro
aprimediet/php:8-apache-ubi9-micro
aprimediet/php:apache-ubi9-micro

View File

@ -15,7 +15,8 @@ RUN dnf -y update && \
dnf -y install https://rpms.remirepo.net/enterprise/remi-release-${UBI_VERSION}.rpm && \
dnf -y install yum-utils && \
dnf -y module reset php && \
dnf -y module install php:remi-${PHP_VERSION} && \
dnf -y module enable php:remi-${PHP_VERSION} && \
dnf -y install php-cli php-common && \
dnf -y autoremove && dnf -y clean all
CMD ["/usr/bin/php"]

72
Dockerfile.ubi9-apache Normal file
View File

@ -0,0 +1,72 @@
ARG REGISTRY_URL=docker.io/aprimediet
ARG PHP_VERSION=8.4
FROM ${REGISTRY_URL}/php:${PHP_VERSION}-ubi9
LABEL maintainer="<Muhamad Aditya Prima> aprimediet@gmail.com"
# Define base System Env
ENV SERVER_ROOT=/app
ENV SERVER_ADMIN=aprimediet@gmail.com
ENV APP_DIR=${SERVER_ROOT}/htdocs
ENV CGI_DIR=${SERVER_ROOT}/cgi-bin
ENV RUN_DIR=${SERVER_ROOT}/run
ENV LOG_DIR=${SERVER_ROOT}/logs
ENV LOG_LEVEL=info
ENV PHP_MEMORY_LIMIT=256M
USER root
# Set workdir
WORKDIR /tmp
# Setup httpd User
# Add group and user httpd
# and setup httpd server root
RUN groupmod -g 10001 apache && \
usermod -u 10001 -g 10001 -d ${SERVER_ROOT} -s /sbin/nologin apache && \
mkdir -p ${APP_DIR} && \
mkdir -p ${CGI_DIR} && \
mkdir -p ${RUN_DIR} && \
mkdir -p ${LOG_DIR} && \
ln -ns /etc/httpd/conf ${SERVER_ROOT}/conf && \
ln -ns /etc/httpd/conf.d ${SERVER_ROOT}/conf.d && \
ln -ns /etc/httpd/conf.modules.d ${SERVER_ROOT}/conf.modules.d && \
ln -ns /usr/lib64/httpd/modules ${SERVER_ROOT}/modules && \
ln -ns /var/lib/httpd ${SERVER_ROOT}/state && \
chown apache:apache ${RUN_DIR} && \
chown apache:apache ${LOG_DIR}
# Install httpd
RUN dnf -y update && \
dnf -y install httpd
# Configure httpd
RUN sed -i "s|ServerRoot \"/etc/httpd\"|ServerRoot ${SERVER_ROOT}|" /etc/httpd/conf/httpd.conf && \
sed -i "s|ServerAdmin you@example.com| ServerAdmin ${SERVER_ADMIN}|" /etc/httpd/conf/httpd.conf && \
sed -i "s|DocumentRoot \"/var/www/html\"|DocumentRoot \"${APP_DIR}\"|" /etc/httpd/conf/httpd.conf && \
sed -i "s|Directory \"/var/www\"|Directory \"${APP_DIR}\"|" /etc/httpd/conf/httpd.conf && \
sed -i "s|Directory \"/var/www/html\"|Directory \"${APP_DIR}\"|" /etc/httpd/conf/httpd.conf && \
sed -i "s|AllowOverride None|AllowOverride All|" /etc/httpd/conf/httpd.conf && \
sed -i "s|ErrorLog .*|ErrorLog /dev/stderr \nTransferLog /dev/stdout|" /etc/httpd/conf/httpd.conf && \
sed -i "s|CustomLog .* combined|CustomLog /dev/stdout combined|" /etc/httpd/conf/httpd.conf && \
sed -i "s|LogLevel .*|LogLevel ${LOG_LEVEL}|" /etc/httpd/conf/httpd.conf && \
sed -i "s|ScriptAlias /cgi-bin/ \"/var/www/cgi-bin/\"|ScriptAlias /cgi-bin/ \"${CGI_DIR}/\"|" /etc/httpd/conf/httpd.conf && \
sed -i "s|Directory \"/var/www/cgi-bin\"|Directory \"${CGI_DIR}\"|" /etc/httpd/conf/httpd.conf
# Add initialization script
ADD ./scripts/entrypoint /usr/local/bin/entrypoint
ADD /app /app/htdocs
RUN chmod +x /usr/local/bin/entrypoint && \
rm -vrf /var/www && \
chown -R apache:apache ${APP_DIR} && \
chown -R apache:apache ${CGI_DIR} && \
sed -i "s|version-|${PHP_VERSION}-|" /app/htdocs/index.html
USER apache
WORKDIR ${APP_DIR}
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/entrypoint"]

View File

@ -0,0 +1,65 @@
ARG REGISTRY_URL=docker.io/aprimediet
ARG PHP_VERSION=8.4
FROM ${REGISTRY_URL}/php:${PHP_VERSION}-apache-ubi9 AS builder
LABEL maintainer="<Muhamad Aditya Prima> aprimediet@gmail.com"
FROM ${REGISTRY_URL}/php:${PHP_VERSION}-ubi9-micro AS runtime
LABEL maintainer="<Muhamad Aditya Prima> aprimediet@gmail.com"
# Define base System Env
ENV SERVER_ROOT=/app
ENV SERVER_ADMIN=aprimediet@gmail.com
ENV APP_DIR=${SERVER_ROOT}/htdocs
ENV CGI_DIR=${SERVER_ROOT}/cgi-bin
ENV RUN_DIR=${SERVER_ROOT}/run
ENV LOG_DIR=${SERVER_ROOT}/logs
ENV LOG_LEVEL=info
ENV PHP_MEMORY_LIMIT=256M
USER root
# Create user and group
RUN echo "apache:x:10001:" >> /etc/group && \
echo "apache:x:10001:10001:Apache:/app/htdocs:/sbin/nologin" >> /etc/passwd && \
echo "apache:!!:20070::::::" >> /etc/shadow
# Copy required libs
COPY --from=builder /usr/lib64/httpd /usr/lib64/httpd
COPY --from=builder /usr/lib64/libapr-* /usr/lib64
COPY --from=builder /usr/lib64/libaprutil* /usr/lib64
COPY --from=builder /usr/lib64/libbrotli* /usr/lib64
COPY --from=builder /usr/lib64/libcurl* /usr/lib64
COPY --from=builder /usr/lib64/libexpat* /usr/lib64
COPY --from=builder /usr/lib64/libgcrypt* /usr/lib64
COPY --from=builder /usr/lib64/libgpg-error* /usr/lib64
COPY --from=builder /usr/lib64/liblua* /usr/lib64
COPY --from=builder /usr/lib64/liblz4* /usr/lib64
COPY --from=builder /usr/lib64/libpcre* /usr/lib64
COPY --from=builder /usr/lib64/libssl* /usr/lib64
COPY --from=builder /usr/lib64/libsystemd* /usr/lib64
COPY --from=builder /usr/lib64/libuuid* /usr/lib64
COPY --from=builder /usr/libexec/initscripts/legacy-actions/httpd /usr/libexec/initscripts/legacy-actions/httpd
# Copy PHP Configuration
COPY --from=builder /etc/httpd /etc/httpd
COPY --from=builder /etc/mime.types /etc/mime.types
COPY --from=builder /app /app
# Copy PHP Libs
COPY --from=builder /var/lib/httpd /var/lib/httpd
COPY --from=builder /usr/share/httpd /usr/share/httpd
# Copy Binaries
COPY --from=builder /usr/bin/php /usr/bin/php
COPY --from=builder /usr/bin/php-cgi /usr/bin/php-cgi
COPY --from=builder /usr/bin/phpize /usr/bin/phpize
COPY --from=builder /usr/sbin/httpd /usr/sbin/httpd
COPY --from=builder /usr/local/bin/entrypoint /usr/local/bin/entrypoint
# Create required directory
RUN mkdir -p /var/cache/httpd/proxy
USER apache
WORKDIR ${APP_DIR}

27
app/index.html Normal file
View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to httpd!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to httpd!</h1>
<h2>The aprimediet/php:version-apache variant.</h2>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="https://httpd.apache.org/">httpd.apache.org</a>.</p>
<p>For online documentation specific to the aprimediet/php:version-apache,<br/>
please refer to <a href="https://github.com/aprimediet/docker-php">aprimediet/php</a>.</p>
<p><em>Thank you for using httpd.</em></p>
</body>
</html>