kenken999 commited on
Commit
a0e80b0
1 Parent(s): 3231299

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -54
Dockerfile CHANGED
@@ -1,54 +1,31 @@
1
- # Use the official PHP image with PHP 8.1
2
- FROM php:8.1-apache
3
-
4
- # Install necessary packages and PHP extensions
5
- RUN apt-get update && apt-get install -y \
6
- wget \
7
- git \
8
- gnupg \
9
- lsb-release \
10
- apt-transport-https \
11
- ca-certificates \
12
- libpq-dev \
13
- libsqlite3-dev \
14
- zip \
15
- unzip \
16
- && docker-php-ext-install pgsql pdo_pgsql pdo_sqlite mysqli pdo_mysql
17
-
18
- # Install Composer
19
- COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
20
-
21
- # Copy the Laravel project into the container
22
- COPY ./php/ /var/www/html
23
-
24
- # Ensure .env file is copied
25
- COPY ./php/.env /var/www/html/.env
26
-
27
- # Run composer update to ensure compatible versions of dependencies
28
- RUN composer update --working-dir=/var/www/html --no-scripts
29
-
30
- # Set Apache DocumentRoot to Laravel's public directory
31
- RUN sed -i 's|/var/www/html|/var/www/html/public|' /etc/apache2/sites-available/000-default.conf
32
-
33
- # Change Apache to listen on port 7860
34
- RUN sed -i 's/Listen 80/Listen 7860/' /etc/apache2/ports.conf \
35
- && sed -i 's/:80/:7860/' /etc/apache2/sites-available/000-default.conf
36
-
37
- # Set correct permissions for Laravel directories
38
- RUN chown -R www-data:www-data /var/www/html \
39
- && find /var/www/html -type d -exec chmod 755 {} \; \
40
- && find /var/www/html -type f -exec chmod 644 {} \;
41
-
42
- # Ensure the storage and cache directories have the correct permissions
43
- RUN mkdir -p /var/www/html/storage \
44
- && mkdir -p /var/www/html/bootstrap/cache \
45
- && chown -R www-data:www-data /var/www/html/storage \
46
- && chown -R www-data:www-data /var/www/html/bootstrap/cache \
47
- && chmod -R 775 /var/www/html/storage \
48
- && chmod -R 775 /var/www/html/bootstrap/cache
49
-
50
- # Expose the Apache port
51
- EXPOSE 7860
52
-
53
- # Start Apache
54
- CMD ["apache2-foreground"]
 
1
+ FROM ubuntu:latest
2
+
3
+ RUN apt update -y
4
+ RUN apt upgrade -y
5
+ RUN apt install -y php apache2 curl unzip wget xz-utils php-xml php-sqlite3
6
+ # php-xml php-dom php-pdo php-mysql
7
+ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
8
+ RUN php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
9
+ RUN php composer-setup.php
10
+ RUN php -r "unlink('composer-setup.php');"
11
+ RUN mv composer.phar /usr/local/bin/composer
12
+
13
+ RUN wget https://nodejs.org/dist/v20.17.0/node-v20.17.0-linux-x64.tar.xz
14
+ RUN chmod 777 /node-v20.17.0-linux-x64.tar.xz
15
+ RUN tar -xf '/node-v20.17.0-linux-x64.tar.xz'
16
+ RUN cp -r /node-v20.17.0-linux-x64/bin /node-v20.17.0-linux-x64/include /node-v20.17.0-linux-x64/lib /node-v20.17.0-linux-x64/share /usr/
17
+
18
+ RUN composer create-project laravel/laravel example-app
19
+ RUN cd example-app
20
+ WORKDIR /example-app
21
+ # Verificar que archivos necesitan acceso de escritura o carpetas
22
+ RUN ls -la
23
+ RUN chmod 706 -R /example-app/bootstrap/cache
24
+ RUN chmod 760 -R /example-app/storage
25
+ RUN chmod 706 /example-app/database/database.sqlite
26
+ RUN chown -R ubuntu:ubuntu /example-app
27
+ RUN apt install -y mariadb-server sudo
28
+ RUN usermod -aG sudo ubuntu
29
+ USER root:root
30
+ RUN sudo service mariadb start; service --status-all
31
+ CMD [ "bash","-c" , "sudo su; id; whoami; ls -la database; service mariadb start; php artisan serve --host=0.0.0.0 --port=7860 > /dev/null 2>&1"]