Skip to content

Commit

Permalink
Finish initial docker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
perisicnikola37 committed Mar 12, 2024
1 parent 79f9e1c commit 7f10a84
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 10 deletions.
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM php:8.2-cli

WORKDIR /var/www/html

RUN apt-get update && apt-get install -y \
curl \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
zip \
unzip \
nodejs \
npm

RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd pdo pdo_mysql zip

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY composer.json composer.lock ./

RUN composer install --no-scripts --no-autoloader

COPY . .

RUN composer dump-autoload

RUN apt-get update && apt-get install -y \
nodejs \
npm

RUN npm install

RUN php artisan config:clear

EXPOSE 9000

CMD php artisan serve --host=0.0.0.0 --port=9000

20 changes: 10 additions & 10 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
*/

'default' => env('DB_CONNECTION', 'mysql'),

Expand All @@ -31,7 +31,7 @@
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
*/

'connections' => [

Expand All @@ -46,11 +46,11 @@
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'host' => env('DB_HOST', 'mysql'),
'port' => env('DB_PORT', '3307'),
'database' => env('DB_DATABASE', 'application_database'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'Expense.tracker.password_2024!'),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
Expand Down Expand Up @@ -104,7 +104,7 @@
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
*/

'migrations' => 'migrations',

Expand All @@ -117,15 +117,15 @@
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
*/

'redis' => [

'client' => env('REDIS_CLIENT', 'phpredis'),

'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
],

'default' => [
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.8'

services:
application:
restart: always
build:
context: .
dockerfile: Dockerfile
ports:
- "9000:9000"
depends_on:
- mysql

mysql:
image: mysql:latest
environment:
MYSQL_DATABASE: LaravelInertiaVueSpa.Database_2024!
MYSQL_ROOT_PASSWORD: LaravelInertiaVueSpa.Password_2024!
ports:
- "3307:3307"

0 comments on commit 7f10a84

Please sign in to comment.