FROM --platform=linux/amd64 alpine:3.19.0

# Update package
RUN apk update --no-cache

RUN apk add --no-cache \
    bash \
    git \
    vim \
    zip

# APACHE2
RUN apk add --no-cache \
    build-base \
    autoconf \
    curl \
    tar \
    libtool \
    pcre-dev \
    libxml2-dev \
    openssl \
    bison \
    re2c \
    file \
    libressl-dev

# NOTE: APACHE
RUN apk add --no-cache \
    php$phpverx-apache2 \
    apache2 \
    apache2-utils \
    apache2-ssl
# config httpd.conf
RUN sed -i '/LoadModule rewrite_module/s/^#//g' /etc/apache2/httpd.conf

# NOTE: PHP
RUN apk add --no-cache \
    composer \
    php82-common \
    php82-zip \
    php82-curl \
    php82-pdo \
    php82-pdo_mysql \
    php82-mysqli \
    php82-openssl \
    php82-mbstring \
    php82-zip \
    php82-bcmath \
    php82-ctype \
    php82-dom \
    php82-gd \
    php82-intl \
    php82-simplexml \
    php82-soap \
    php82-sodium \
    php82-xsl \
    php82-tokenizer \
    php82-fileinfo \
    php82-sockets \
    php82-xml \
    php82-xmlwriter \
    php82-session \
    php82-apache2
# config php.ini
RUN sed -i 's/memory_limit = 128M/memory_limit = -1/' /etc/php82/php.ini

# Working file
WORKDIR /var/www/html
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
