fixed apache dockerfile
Build and push PHP 7 container images / Build PHP 7 builder container images (map[os:alpine os_version:3.12 php_ver_short:7 php_version:7.3]) (push) Successful in 48s Details
Build and push PHP 7 container images / Build PHP 7 builder container images (map[os:alpine os_version:3.15 php_ver_short:7 php_version:7.4]) (push) Successful in 53s Details
Build and push PHP 7 container images / Build PHP 7 builder container images (map[os:alpine os_version:3.9 php_ver_short:7 php_version:7.2]) (push) Successful in 45s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.12 php_ver_short:7 php_version:7.3 with_database:false with_server:apache]) (push) Successful in 1m16s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.12 php_ver_short:7 php_version:7.3 with_database:false with_server:false]) (push) Successful in 1m4s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.12 php_ver_short:7 php_version:7.3 with_database:mysql with_server:apache]) (push) Successful in 1m19s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.12 php_ver_short:7 php_version:7.3 with_database:postgresql with_server:apache]) (push) Successful in 1m23s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.15 php_ver_short:7 php_version:7.4 with_database:false with_server:apache]) (push) Successful in 1m23s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.15 php_ver_short:7 php_version:7.4 with_database:false with_server:false]) (push) Successful in 1m2s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.15 php_ver_short:7 php_version:7.4 with_database:mysql with_server:apache]) (push) Successful in 1m20s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.15 php_ver_short:7 php_version:7.4 with_database:postgresql with_server:apache]) (push) Successful in 1m23s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.9 php_ver_short:7 php_version:7.2 with_database:false with_server:apache]) (push) Successful in 1m24s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.9 php_ver_short:7 php_version:7.2 with_database:false with_server:false]) (push) Successful in 1m4s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.9 php_ver_short:7 php_version:7.2 with_database:mysql with_server:apache]) (push) Successful in 1m8s Details
Build and push PHP 7 container images / Build PHP 7 container images (map[os:alpine os_version:3.9 php_ver_short:7 php_version:7.2 with_database:postgresql with_server:apache]) (push) Successful in 1m7s Details

This commit is contained in:
Muhamad Aditya Prima 2024-12-27 15:18:29 +07:00
parent 957be72936
commit cddffeaf25
7 changed files with 6 additions and 65 deletions

View File

@ -6,19 +6,21 @@ ARG PHP_VERSION=7.4
FROM quay.io/sindigilive/php:${PHP_VERSION}-builder-alpine AS builder FROM quay.io/sindigilive/php:${PHP_VERSION}-builder-alpine AS builder
ARG WITH_APACHE=false USER root
ARG WITH_APACHE=true
ARG WITH_DATABASE=false ARG WITH_DATABASE=false
ENV WITH_APACHE=${WITH_APACHE} ENV WITH_APACHE=${WITH_APACHE}
ENV WITH_DATABASE=${WITH_DATABASE} ENV WITH_DATABASE=${WITH_DATABASE}
ADD ./scripts/apache-entrypoint.sh /usr/local/bin/entrypoint.sh ; ADD scripts/apache-entrypoint.sh /usr/local/bin/entrypoint
# Create directory, and install required php app # Create directory, and install required php app
RUN /bin/sh /tmp/setup.sh; \ RUN /bin/sh /tmp/setup.sh; \
/bin/rm -f /tmp/*.sh; \ /bin/rm -f /tmp/*.sh; \
rm -vrf /var/cache/apk/*; \ rm -vrf /var/cache/apk/*; \
chmod +rx /usr/local/bin/entrypoint.sh ; chmod +rx /usr/local/bin/entrypoint ;
FROM scratch FROM scratch
@ -47,4 +49,4 @@ WORKDIR /app/htdocs
STOPSIGNAL SIGQUIT STOPSIGNAL SIGQUIT
CMD ["/usr/local/bin/entrypoint.sh"] CMD ["/usr/local/bin/entrypoint"]

View File

@ -1,61 +0,0 @@
ARG REGISTRY_URL=docker.io/aprimediet
ARG PHP=8.3
FROM ${REGISTRY_URL}/php:${PHP}-alpine
LABEL maintainer="<Muhamad Aditya Prima> aprimediet@gmail.com"
# DEFINE ENV
ENV SERVER_ROOT=/app
ENV SERVER_ADMIN=you@example.com
ENV APP_DIR=${SERVER_ROOT}/htdocs
ENV LOG_LEVEL=info
ENV PHP_MEMORY_LIMIT=256M
# SET WORKDIR
WORKDIR /tmp
# SETUP APACHE2 USER
RUN addgroup -g 10001 apache && \
adduser -D -u 10001 -G apache -s /bin/sh -h ${APP_DIR} apache
# INSTALL APACHE2
RUN --mount=type=cache,target=/var/cache/apk \
apk upgrade && apk add --update \
apache2 php${PHP_VERSION}-apache2
# CREATE SYMLINKS TO /app
RUN mkdir -p ${APP_DIR} && \
mkdir -p ${SERVER_ROOT}/logs && \
mkdir -p ${SERVER_ROOT}/run && \
ln -s /usr/lib/apache2 ${SERVER_ROOT}/modules && \
chmod -R 755 ${SERVER_ROOT}/logs && \
chmod -R 755 ${SERVER_ROOT/run}
# CONFIGURE HTTPD
RUN sed -i "s|ServerRoot /var/www|ServerRoot ${SERVER_ROOT}|" /etc/apache2/httpd.conf && \
sed -i "s|ServerAdmin you@example.com| ServerAdmin ${SERVER_ADMIN}|" /etc/apache2/httpd.conf && \
sed -i "s|DocumentRoot \"/var/www/localhost/htdocs\"|DocumentRoot \"${APP_DIR}\"|" /etc/apache2/httpd.conf && \
sed -i "s|Directory \"/var/www/localhost/htdocs\"|Directory \"${APP_DIR}\"|" /etc/apache2/httpd.conf && \
sed -i "s|AllowOverride None|AllowOverride All|" /etc/apache2/httpd.conf && \
sed -i "s|ErrorLog .*|ErrorLog /dev/stderr \nTransferLog /dev/stdout|" /etc/apache2/httpd.conf && \
sed -i "s|CustomLog .* combined|CustomLog /dev/stdout combined|" /etc/apache2/httpd.conf && \
sed -i "s|LogLevel .*|LogLevel ${LOG_LEVEL}|" /etc/apache2/httpd.conf && \
sed -i "s|#LoadModule rewrite_module|LoadModule rewrite_module|" /etc/apache2/httpd.conf && \
sed -i "s|#LoadModule deflate_module|LoadModule deflate_module|" /etc/apache2/httpd.conf && \
sed -i "s|#LoadModule expires_module|LoadModule expires_module|" /etc/apache2/httpd.conf && \
sed -i "s|Require host .example.com|#Require host .example.com|" /etc/apache2/conf.d/info.conf && \
sed -i "s|Require ip 127|Require all granted|" /etc/apache2/conf.d/info.conf
# ADD INITIALIZATION SCRIPT
ADD ./scripts/entrypoint /usr/local/bin/entrypoint
RUN chmod +x /usr/local/bin/entrypoint && \
cp -vR /var/www/localhost/htdocs/* ${APP_DIR}/ && \
rm -vrf /var/www && \
chown -R apache:apache ${APP_DIR}
WORKDIR ${APP_DIR}
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/entrypoint"]