Skip to content

Commit

Permalink
fix: dockerization feature
Browse files Browse the repository at this point in the history
  • Loading branch information
perisicnikola37 committed Jan 23, 2025
1 parent df16c7d commit 21490f9
Show file tree
Hide file tree
Showing 5 changed files with 571 additions and 540 deletions.
14 changes: 7 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_NAME=Laravel
APP_NAME=LaravelInertiaVueSpa
APP_ENV=local
APP_KEY=
APP_DEBUG=true
Expand All @@ -9,11 +9,11 @@ LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=LaravelInertiaVueSpa.Database_2024!
DB_USERNAME=root
DB_PASSWORD=LaravelInertiaVueSpa.Password_2024!

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down Expand Up @@ -55,4 +55,4 @@ VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM php:8.2-cli

WORKDIR /var/www/html

# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
libpng-dev \
Expand All @@ -15,29 +14,27 @@ RUN apt-get update && apt-get install -y \
npm \
&& rm -rf /var/lib/apt/lists/*

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

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

# Copy composer files and install dependencies
COPY composer.json composer.lock ./
RUN composer install --no-scripts --no-autoloader

# Copy the rest of the application files
COPY . .

# Generate autoload files
RUN npm install
RUN npm run build

RUN composer dump-autoload

# Install npm packages and build
RUN npm install && npm run build
RUN php artisan storage:link

RUN php artisan key:generate

# Expose ports for both PHP and npm servers
EXPOSE 9000
EXPOSE 5173
# Expose ports for PHP server and frontend
EXPOSE 9000 3000

# Set up command to run both services
CMD php artisan serve --host=0.0.0.0 --port=9000 & npm run dev --host 0.0.0.0 --port 5173
# Set up command to run both PHP server and frontend
CMD php artisan serve --host=0.0.0.0 --port=9000 & npm run dev -- --host
Loading

0 comments on commit 21490f9

Please sign in to comment.