Update Dockerfile
Browse files- Dockerfile +31 -54
Dockerfile
CHANGED
@@ -1,54 +1,31 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
RUN apt-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
#
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
RUN
|
29 |
-
|
30 |
-
|
31 |
-
|
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"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|