diff --git a/docker/Dockerfile b/docker/Dockerfile index 16a0657..5f416d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,7 +20,9 @@ RUN add-apt-repository ppa:ondrej/php RUN apt update # install app dependencies -RUN DEBIAN_FRONTEND=noninteractive TZ=Europe/Lisbon apt install php8.2 php8.2-simplexml php8.2-curl php8.2-dom composer npm -y +RUN DEBIAN_FRONTEND=noninteractive TZ=Europe/Lisbon apt install php8.2 \ + php8.2-simplexml php8.2-curl php8.2-dom php8.2-mysql composer npm \ + mysql-client -y ENV DB_CONNECTION=mysql ENV DB_HOST=laraveldb @@ -35,10 +37,11 @@ RUN php artisan key:generate # seed data if build arg is provided RUN if [ "$SEED_DATA" = true ]; then php artisan migrate --seed; fi -EXPOSE 8000 - RUN npm install RUN npm run build #Open on port 8000 to all addresses -ENTRYPOINT php artisan serve --port=8000 --host=0.0.0.0 +# COPY entrypoint.sh . +# RUN chmod +x entrypoint.sh +ENTRYPOINT php artisan migrate --seed; php artisan serve --port=8000 --host=0.0.0.0 +EXPOSE 8000 diff --git a/docker/clean.sh b/docker/clean.sh new file mode 100755 index 0000000..4c7c5eb --- /dev/null +++ b/docker/clean.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -x + +docker stop laravel laraveldb +docker container rm laravel laraveldb + +docker image rm laravelio + diff --git a/docker/start.sh b/docker/start.sh index 866afc9..2e0be06 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -25,6 +25,8 @@ then docker build . -t laravelio fi +sleep 5 + docker run --name laravel --net laravel_net -p 80:8000 -d \ -e DB_CONNECTION=mysql \ -e DB_HOST=laraveldb \ @@ -33,5 +35,6 @@ docker run --name laravel --net laravel_net -p 80:8000 -d \ -e DB_PASSWORD=password \ laravelio +sleep 5 curl --write-out '%{http_code}' --silent http://localhost:80/ --output output.html