tello2 / Dockerfile
ladogton2010's picture
Dockerfile updated
58a343e
FROM ubuntu:latest
RUN apt update -y
RUN apt upgrade -y
RUN apt install -y php curl unzip wget xz-utils php-xml php-curl php-mysql php-pdo php-mbstring tree
RUN rm -rf /var/lib/apt/lists/*
USER ubuntu
ENV HOME=/home/ubuntu \
PATH=/home/ubuntu/.local/bin:$PATH
WORKDIR $HOME
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
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;"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"
USER root
RUN mv composer.phar /usr/local/bin/composer
USER ubuntu
RUN wget https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-x64.tar.xz
RUN chmod 777 ./node-v20.18.1-linux-x64.tar.xz
RUN tar -xf './node-v20.18.1-linux-x64.tar.xz'
USER root
RUN cp -r $HOME/node-v20.18.1-linux-x64/bin $HOME/node-v20.18.1-linux-x64/include $HOME/node-v20.18.1-linux-x64/lib $HOME/node-v20.18.1-linux-x64/share /usr/
USER ubuntu
RUN mkdir example-app
WORKDIR $HOME/example-app
COPY --chown=ubuntu app/ ./
RUN echo "===================== ls -la /home/ubuntu/example-app" ; ls -la /home/ubuntu/example-app ;
RUN chmod 777 -R $HOME/example-app
RUN composer install
RUN composer clear-cache
RUN php artisan cache:clear
RUN php artisan config:clear
RUN php artisan config:cache
RUN composer clear-cache
RUN composer install
RUN npm install
RUN cp $HOME/example-app/.env.example $HOME/example-app/.env
RUN php artisan key:generate
#RUN mkdir -p $HOME/example-app/public/storage/images
RUN chmod 777 -R $HOME/example-app
RUN chown -R ubuntu:ubuntu $HOME/example-app
CMD \
sed -i "s|\$DB-DATABASE|$DB_DATABASE|" .env && \
sed -i "s|\$DB-USERNAME|$DB_USERNAME|" .env && \
sed -i "s|\$DB-HOST|$DB_HOST|" .env && \
sed -i "s|\$DB-PORT|$DB_PORT|" .env && \
sed -i "s|\$DB-PASSWORD|$DB_PASSWORD|" .env && \
echo "===================== composer clear-cache"; composer clear-cache; \
echo "===================== composer install"; composer install; \
echo "===================== chown -R ubuntu:ubuntu $HOME/example-app"; chown -R ubuntu:ubuntu $HOME/example-app; \
echo "===================== php artisan cache:clear" ; php artisan cache:clear ; \
echo "===================== php artisan config:clear" ; php artisan config:clear ; \
echo "===================== php artisan config:cache" ; php artisan config:cache ; \
echo "===================== ls -la /home/ubuntu/example-app" ; ls -la /home/ubuntu/example-app ; \
echo "===================== php artisan storage:link"; php artisan storage:link; \
echo "===================== chmod 777 -R $HOME/example-app";chmod 777 -R $HOME/example-app; \
echo "===================== php artisan migrate"; php artisan migrate; \
echo "===================== php artisan migrate:status"; php artisan migrate:status; \
# echo "===================== tree /home/ubuntu/example-app" ; tree /home/ubuntu/example-app ; \
# echo "===================== ls -la /home/ubuntu/example-app" ; ls -la /home/ubuntu/example-app ; \
echo "===================== php artisan serve --host=0.0.0.0 --port=7860"; php artisan serve --host=0.0.0.0 --port=7860