generated from Logisim-Evolution/Laravel-Docker
Initial commit
This commit is contained in:
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=""
|
||||
8
images/Laravel_Dockerfile
Normal file
8
images/Laravel_Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM bitnami/laravel
|
||||
|
||||
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
|
||||
19
images/SQL_Dockerfile
Normal file
19
images/SQL_Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM mariadb:latest as builder
|
||||
|
||||
COPY db_init.sql /docker-entrypoint-initdb.d/
|
||||
|
||||
# That file does the DB initialization but also runs mysql daemon, by removing the last line it will only init
|
||||
RUN ["sed", "-i", "s/exec \"$@\"/echo \"not running $@\"/", "/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
ENV MARIADB_USER=root
|
||||
ENV MARIADB_ROOT_PASSWORD=super_strong_password
|
||||
|
||||
# Need to change the datadir to something else that /var/lib/mysql because the parent docker file defines it as a volume.
|
||||
# https://docs.docker.com/engine/reference/builder/#volume :
|
||||
# Changing the volume from within the Dockerfile: If any build steps change the data within the volume after
|
||||
# it has been declared, those changes will be discarded.
|
||||
RUN ["/usr/local/bin/docker-entrypoint.sh", "mariadbd", "--datadir", "/initialized-db", "--aria-log-dir-path", "/initialized-db"]
|
||||
|
||||
FROM mariadb:latest
|
||||
|
||||
COPY --from=builder /initialized-db /var/lib/mysql
|
||||
3
images/db_init.sql
Normal file
3
images/db_init.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
CREATE USER laravel_user IDENTIFIED BY 'super_strong_password';
|
||||
|
||||
GRANT CREATE, ALTER, DROP, SELECT, INSERT, UPDATE, DELETE ON laravel_db.* TO laravel_user;
|
||||
11
images/init_laravel.sh
Normal file
11
images/init_laravel.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/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 migrate --force
|
||||
php artisan serve --host=0.0.0.0 --port=8000
|
||||
Reference in New Issue
Block a user