hcportal-dev/Dockerfile.backend
2025-08-12 08:48:46 +07:00

57 lines
1.6 KiB
Docker

# Use the official PHP 7.3 Apache base image
FROM php:7.3-apache
# Install system dependencies
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
unzip \
git \
curl \
rsyslog
# Install PHP extensions
RUN docker-php-ext-install pdo pdo_mysql mysqli zip
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install -j$(nproc) gd
# Install Composer version 1
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.22
WORKDIR /app
# Copying Config Files
COPY ./be/src/api/composer.json ./src/api/composer.json
COPY ./be/src/api/Aiko/ ./src/api/Aiko/
COPY ./be/src/api/Helper/ ./src/api/Helper/
RUN cd /app/src/api && composer install
# Copying controllers
COPY ./be .
RUN cd /app/src/api && composer dump-autoload -o
RUN chmod -R 777 /app/src/api/log && chmod -R 777 /app/src/api/vendor
# Configure Apache
COPY apache-config.conf /etc/apache2/sites-available/000-default.conf
COPY custom-logging.conf /etc/apache2/conf-available/custom-logging.conf
RUN a2enmod proxy && \
a2enmod proxy_http && \
a2enmod proxy_balancer && \
a2enmod lbmethod_byrequests && \
a2enmod rewrite && \
a2enconf custom-logging
# Copy rsyslog configuration
COPY rsyslog.conf /etc/rsyslog.conf
# Create and set permissions for the start script
COPY entrypoint-backend.sh /usr/local/bin/start-services.sh
RUN chmod +x /usr/local/bin/start-services.sh
# Use the script as the entry point
CMD ["/usr/local/bin/start-services.sh"]