better docker scripts
This commit is contained in:
32
Makefile
Normal file
32
Makefile
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
DOCKER_CONTAINER_NAME=isi2-laravel-1
|
||||||
|
DOCKER_CMD=docker exec -it $(DOCKER_CONTAINER_NAME)
|
||||||
|
|
||||||
|
# Launch the container detached
|
||||||
|
all:
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
# Launch the container
|
||||||
|
run:
|
||||||
|
docker compose up
|
||||||
|
|
||||||
|
# Stop the container
|
||||||
|
stop:
|
||||||
|
docker compose down
|
||||||
|
|
||||||
|
# Stop the container and wipe the database
|
||||||
|
down:
|
||||||
|
docker compose down -v
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# These tasks need the docker container to be running
|
||||||
|
|
||||||
|
exec_container:
|
||||||
|
$(DOCKER_CMD) bash
|
||||||
|
|
||||||
|
seed:
|
||||||
|
$(DOCKER_CMD) php artisan db:seed --class=$(CLASS)
|
||||||
|
|
||||||
|
migrate:
|
||||||
|
$(DOCKER_CMD) php artisan migrate
|
||||||
7
images/.env
Normal file
7
images/.env
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
DB_CONNECTION=mariadb
|
||||||
|
DB_HOST=mariadb
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=laravel_db
|
||||||
|
DB_USERNAME=laravel_user
|
||||||
|
DB_PASSWORD=super_strong_password
|
||||||
|
APP_KEY=""
|
||||||
@@ -4,4 +4,9 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | ba
|
|||||||
|
|
||||||
RUN . ~/.nvm/nvm.sh && nvm install --lts
|
RUN . ~/.nvm/nvm.sh && nvm install --lts
|
||||||
|
|
||||||
RUN composer require laravel/breeze --dev
|
COPY init_laravel.sh /init/init_laravel.sh
|
||||||
|
COPY .env /init/.env
|
||||||
|
|
||||||
|
RUN chmod +x /init/init_laravel.sh
|
||||||
|
|
||||||
|
CMD bash /init/init_laravel.sh
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
composer require laravel/breeze --dev
|
|
||||||
php artisan breeze:install blade
|
|
||||||
php artisan migrate
|
|
||||||
12
images/init_laravel.sh
Normal file
12
images/init_laravel.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
composer install
|
||||||
|
|
||||||
|
# Create .env if it does not exist
|
||||||
|
if ! [ -e ".env" ] ; then
|
||||||
|
cp /init/.env .
|
||||||
|
php artisan key:generate
|
||||||
|
fi
|
||||||
|
|
||||||
|
php artisan breeze:install blade
|
||||||
|
php artisan migrate --force
|
||||||
|
php artisan serve --host=0.0.0.0 --port=8000
|
||||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "isi2",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user