kenken999 commited on
Commit
db52a47
·
1 Parent(s): 3ca9158
Files changed (1) hide show
  1. Dockerfile +18 -21
Dockerfile CHANGED
@@ -1,5 +1,4 @@
1
- # Use the official PHP image
2
- FROM php:8.2-apache
3
 
4
  # Install necessary packages and PHP extensions
5
  RUN apt-get update && apt-get install -y \
@@ -18,40 +17,38 @@ RUN apt-get update && apt-get install -y \
18
  # Install Composer
19
  COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
20
 
 
 
 
21
  # Set environment variables for Composer
22
  ENV PATH="$PATH:/root/.composer/vendor/bin"
23
 
24
- # Install Laravel installer
25
- RUN composer global require laravel/installer
26
-
27
- # Create a new Laravel project directly in the web root
28
  RUN laravel new /var/www/html
29
 
30
  # Download and set up phpMyAdmin from GitHub
31
  RUN wget https://github.com/phpmyadmin/phpmyadmin/archive/refs/tags/RELEASE_5_1_4.tar.gz -O phpmyadmin.tar.gz \
32
- && tar -xzvf phpmyadmin.tar.gz -C /var/www/ \
33
- && mv /var/www/phpmyadmin-RELEASE_5_1_4 /var/www/html/phpmyadmin \
34
  && rm phpmyadmin.tar.gz
35
 
36
  # Change Apache to listen on port 7860
37
  RUN sed -i 's/Listen 80/Listen 7860/' /etc/apache2/ports.conf \
38
  && sed -i 's/:80/:7860/' /etc/apache2/sites-available/000-default.conf
39
 
40
- # Set Apache DocumentRoot to Laravel's public directory
41
- RUN sed -i 's|/var/www/html|/var/www/html/public|' /etc/apache2/sites-available/000-default.conf
42
-
43
  # Set correct permissions for directories
44
- RUN chown -R www-data:www-data /var/www/html \
45
- && find /var/www/html -type d -exec chmod 755 {} \; \
46
- && find /var/www/html -type f -exec chmod 644 {} \;
 
 
 
 
 
 
47
 
48
  # Ensure the SQLite database file and directory have the correct permissions
49
- RUN mkdir -p /var/www/html/storage \
50
- && mkdir -p /var/www/html/bootstrap/cache \
51
- && chown -R www-data:www-data /var/www/html/storage \
52
- && chown -R www-data:www-data /var/www/html/bootstrap/cache \
53
- && chmod -R 775 /var/www/html/storage \
54
- && chmod -R 775 /var/www/html/bootstrap/cache
55
 
56
  # Set environment variables
57
  ENV PMA_HOST=mysql-7364790-localbugtv.l.aivencloud.com
@@ -63,4 +60,4 @@ ENV APACHE_PORT=7860
63
  EXPOSE 7860
64
 
65
  # Start Apache
66
- CMD ["apache2-foreground"]
 
1
+ ROM php:8.2-apache
 
2
 
3
  # Install necessary packages and PHP extensions
4
  RUN apt-get update && apt-get install -y \
 
17
  # Install Composer
18
  COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
19
 
20
+ # Install Laravel
21
+ RUN composer global require laravel/installer
22
+
23
  # Set environment variables for Composer
24
  ENV PATH="$PATH:/root/.composer/vendor/bin"
25
 
26
+ # Create a new Laravel project
 
 
 
27
  RUN laravel new /var/www/html
28
 
29
  # Download and set up phpMyAdmin from GitHub
30
  RUN wget https://github.com/phpmyadmin/phpmyadmin/archive/refs/tags/RELEASE_5_1_4.tar.gz -O phpmyadmin.tar.gz \
31
+ && tar -xzvf phpmyadmin.tar.gz -C /var/www/html --strip-components=1 \
 
32
  && rm phpmyadmin.tar.gz
33
 
34
  # Change Apache to listen on port 7860
35
  RUN sed -i 's/Listen 80/Listen 7860/' /etc/apache2/ports.conf \
36
  && sed -i 's/:80/:7860/' /etc/apache2/sites-available/000-default.conf
37
 
 
 
 
38
  # Set correct permissions for directories
39
+ RUN chmod -R 777 /var/ \
40
+ && chmod -R 777 /etc/apache2/
41
+
42
+ # Set correct permissions for phpMyAdmin configuration file
43
+ # (if applicable, ensure the file exists first)
44
+ RUN [ -f /var/www/html/phpmyadmin/config.inc.php ] && chmod 644 /var/www/html/phpmyadmin/config.inc.php || true
45
+
46
+ # Copy all contents of the app folder to the /var/www/html/ directory
47
+ COPY ./php/ /var/www/html/
48
 
49
  # Ensure the SQLite database file and directory have the correct permissions
50
+ RUN chown -R www-data:www-data /var/www/html/ \
51
+ && chmod -R 777 /var/www/html/
 
 
 
 
52
 
53
  # Set environment variables
54
  ENV PMA_HOST=mysql-7364790-localbugtv.l.aivencloud.com
 
60
  EXPOSE 7860
61
 
62
  # Start Apache
63
+ CMD ["apache2-foreground"]