php / Dockerfile
kenken999's picture
sd
833e7d7
raw
history blame
1.92 kB
# Use the official PHP image
FROM php:8.2-apache
# Install necessary packages and PHP extensions
RUN apt-get update && apt-get install -y \
wget \
git \
gnupg \
lsb-release \
apt-transport-https \
ca-certificates \
libpq-dev \
libsqlite3-dev \
zip \
unzip \
&& docker-php-ext-install pgsql pdo_pgsql pdo_sqlite
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install Laravel
RUN composer global require laravel/installer
# Set environment variables for Composer
ENV PATH="$PATH:/root/.composer/vendor/bin"
# Create a new Laravel project
RUN laravel new /var/www/html/laravel
# Download and set up phpMyAdmin from GitHub
RUN wget https://github.com/phpmyadmin/phpmyadmin/archive/refs/tags/RELEASE_5_1_4.tar.gz -O phpmyadmin.tar.gz \
&& tar -xzvf phpmyadmin.tar.gz -C /var/www/html --strip-components=1 \
&& rm phpmyadmin.tar.gz
# Change Apache to listen on port 7860
RUN sed -i 's/Listen 80/Listen 7860/' /etc/apache2/ports.conf \
&& sed -i 's/:80/:7860/' /etc/apache2/sites-available/000-default.conf
# Set correct permissions for directories
RUN chmod -R 777 /var/ \
&& chmod -R 777 /etc/apache2/
# Set correct permissions for phpMyAdmin configuration file
# (if applicable, ensure the file exists first)
RUN [ -f /var/www/html/phpmyadmin/config.inc.php ] && chmod 644 /var/www/html/phpmyadmin/config.inc.php || true
# Copy all contents of the app folder to the /var/www/html/ directory
COPY ./php/ /var/www/html/
# Ensure the SQLite database file and directory have the correct permissions
RUN chown -R www-data:www-data /var/www/html/ \
&& chmod -R 777 /var/www/html/
# Set environment variables
ENV PMA_HOST=mysql-7364790-localbugtv.l.aivencloud.com
ENV PMA_PORT=10490
ENV MYSQL_ROOT_PASSWORD=root
ENV APACHE_PORT=7860
# Expose the Apache port
EXPOSE 7860
# Start Apache
CMD ["apache2-foreground"]