fixed composer setup and added build arg to seed data

This commit is contained in:
Tiago Sousa 2023-10-30 11:55:28 +00:00
parent 59fc9c9636
commit deb800348f

View file

@ -1,5 +1,6 @@
# Dockerfile for the laravel.io application
ARG SEED_DATA=false
FROM ubuntu:22.04
RUN apt update
@ -16,7 +17,7 @@ RUN add-apt-repository ppa:ondrej/php
RUN apt update
# install app dependencies
RUN DEBIAN_FRONTEND=noninteractive TZ=Europe/Lisbon apt install tzdata 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 composer npm -y
ENV DB_CONNECTION=mysql
ENV DB_HOST=laraveldb
@ -26,6 +27,13 @@ ENV DB_PASSWORD=password
RUN composer install
RUN composer setup
RUN mv .env.example .env
RUN php artisan key:generate
# seed data if build arg is provided
RUN if [ $SEED_DATA = true ]; then php artisan migrate --seed; fi
RUN npm install
RUN npm run build
EXPOSE 8000