updated docker

This commit is contained in:
Frank John Begornia
2023-12-30 00:26:02 +08:00
parent 3394c94677
commit 78d99b5ff6
4 changed files with 90 additions and 49 deletions

View File

@@ -1,46 +1,41 @@
# Use the official PHP image based on Alpine Linux
FROM php:5.6-fpm-alpine
# Use an official PHP 5.6 Apache image
FROM php:5.6-apache
# Install system dependencies and PHP extensions
RUN apk --update --no-cache add \
nginx \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
libzip-dev \
zip \
unzip \
libmcrypt-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo pdo_mysql zip mcrypt
# Set the working directory inside the container
WORKDIR /var/www/html
# Set the working directory in the container
WORKDIR /var/www
# Install required dependencies
RUN apt-get update && \
apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng12-dev \
libmcrypt-dev \
libzip-dev \
unzip \
git \
curl
# Clear cache
# RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy the Laravel application files to the container
COPY . .
# Set appropriate permissions for Laravel storage and bootstrap cache
RUN chown -R www-data:www-data storage bootstrap
# Install Composer
# Install Composer globally
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Enable required PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring zip mcrypt
# Enable Apache modules
RUN a2enmod rewrite
# Copy the Laravel application files into the container
COPY . .
# Install Laravel dependencies
RUN composer install --no-plugins --no-scripts
RUN composer install --no-interaction --optimize-autoloader
# Generate Laravel application key
RUN php artisan key:generate
# Set permissions
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap
# Create directory for the socket and set permissions
RUN mkdir -p /run/php && chown www-data:www-data /run/php
# Expose port 80
EXPOSE 80
# Copy the www.conf file to PHP-FPM pool.d directory
# COPY www.conf /usr/local/etc/php-fpm.d/www.conf
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
# Start the Apache server
CMD ["apache2-foreground"]

View File

@@ -67,18 +67,24 @@
</div>
<div class="col-lg-8 mt-5">
<form action="">
<div id="login-response-msg"></div>
<form role="form" id="frm-login">
<input type="hidden" name="redirect" value="{{ Request::get('redirectUrl') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="mb-3">
<input
type="text"
class="form-control form-control-lg contact-input-custom"
placeholder="Username*"
name="email" value="{{ old('email') }}"
required
/>
</div>
<div class="mb-3">
<input
type="password"
name="password"
class="form-control form-control-lg contact-input-custom"
required
placeholder="Password*"

View File

@@ -188,7 +188,7 @@
<p class="text-start">
Already have an account?
<router-link to="/login">Login</router-link>
<a href="{{ url('./auth/login') }}">Login</a>
</p>
</form>
</div>

View File

@@ -84,24 +84,64 @@
</ul>
<ul class="navbar-nav ms-auto">
@if (Auth::guest())
<li class="nav-item">
<a class="nav-link" href="{{ url('./auth/register') }}">
<i class="icon icon-sign-up"></i> Sign Up
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url('./auth/login') }}">
<i class="icon icon-sign-in"></i>
Log In
</a>
</li>
@else
@if(Auth::user()->role == "admin")
<li class="nav-item">
<a class="nav-link" href="{{ url('./auth/register') }}">
<i class="icon icon-sign-up"></i> Sign Up
<a class="nav-link" href="{{ url('./auth/admin') }}">
{{-- <i class="icon icon-sign-in"></i> --}}
Dashboard
</a>
</li>
@elseif(Auth::user()->role == "store_owner")
<li class="nav-item">
<!-- <router-link to="/login" class="nav-link">
<i class="icon icon-sign-in"></i>
Log In
</router-link> -->
<a class="nav-link" href="{{ url('./auth/login') }}">
<i class="icon icon-sign-in"></i>
Log In
{{-- <a href="{{ url('user') }}" class="nav-link btn btn-white-outline btn-sm text-uppercase mx-1">Dashboard</a> --}}
<a class="nav-link" href="{{ url('./auth/user') }}">
{{-- <i class="icon icon-sign-in"></i> --}}
Dashboard
</a>
</li>
@else
<li class="nav-item">
<a class="nav-link" href="#!">
<a class="nav-link" href="{{ url('./auth/user') }}">
{{-- <i class="icon icon-sign-in"></i> --}}
Dashboard
</a>
</li>
@endif
<li class="nav-item">
{{-- <a href="{{ url('./auth/logout') }}" class="nav-link btn btn-white-outline btn-sm text-uppercase mx-1">Logout</a> --}}
<a class="nav-link" href="{{ url('./auth/logout') }}">
<i class="icon icon-sign-in"></i>
Logout
</a>
</li>
@endif
<li class="nav-item">
{{-- <a href="{{ url('cart') }}" type="button" class="nav-link btn btn-navbar-cart btn-sm">
<i class="icon icon-cart"></i>
<span class="badge bg-secondary">{{ \App\Http\Controllers\MainController::getCountCart() }}</span>
</a> --}}
<a class="nav-link" href="{{ url('cart') }}" type="button">
<i class="icon icon-cart"></i>
<span class="badge bg-secondary">{{ \App\Http\Controllers\MainController::getCountCart() }}</span>
</a>
</li>
</ul>