Skip to content

Commit

Permalink
fix docker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpanjwani committed Dec 3, 2021
1 parent 5321871 commit 423e30b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 52 deletions.
77 changes: 34 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
FROM php:7.4-fpm-alpine
FROM php:7.4-fpm

WORKDIR /var/www
# Arguments defined in docker-compose.yml
ARG user
ARG uid

RUN apk add --no-cache \
$PHPIZE_DEPS \
freetype-dev \
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
zip \
libzip-dev \
php7-bcmath \
curl \
unzip \
libjpeg-turbo-dev \
libpng-dev \
libonig-dev \
libxml2-dev \
mariadb-client \
sqlite \
php7-json \
php7-openssl \
php7-pdo \
php7-pdo_mysql \
php7-session \
php7-simplexml \
php7-tokenizer \
php7-xml \
imagemagick \
imagemagick-libs \
imagemagick-dev \
php7-imagick \
php7-pcntl \
--repository http://dl-cdn.alpinelinux.org/alpine/v3.13/community/ gnu-libiconv=1.15-r3

ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php

RUN printf "\n" | pecl install \
imagick && \
docker-php-ext-enable --ini-name 20-imagick.ini imagick

RUN docker-php-ext-configure zip
RUN docker-php-ext-install zip
RUN docker-php-ext-install iconv pdo pdo_mysql bcmath pcntl exif
RUN docker-php-ext-configure gd --with-jpeg --with-freetype
RUN docker-php-ext-install gd

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php');" \
&& mv composer.phar /usr/bin/composer
zip \
unzip \
libzip-dev \
libmagickwand-dev \
mariadb-client

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

RUN pecl install imagick \
&& docker-php-ext-enable imagick

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user

# Set working directory
WORKDIR /var/www

USER $user
16 changes: 9 additions & 7 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('check:invoices:status')
if (\Storage::disk('local')->has('database_created')) {
$schedule->command('check:invoices:status')
->daily();

$schedule->command('check:estimates:status')
$schedule->command('check:estimates:status')
->daily();

$recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get();
foreach ($recurringInvoices as $recurringInvoice) {
$schedule->call(function () use ($recurringInvoice) {
$recurringInvoice->generateInvoice();
})->cron($recurringInvoice->frequency);
$recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get();
foreach ($recurringInvoices as $recurringInvoice) {
$schedule->call(function () use ($recurringInvoice) {
$recurringInvoice->generateInvoice();
})->cron($recurringInvoice->frequency);
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: '3'

services:
app:
Expand Down Expand Up @@ -39,7 +39,7 @@ services:
image: nginx:1.17-alpine
restart: unless-stopped
ports:
- 8080:80
- 80:80
volumes:
- ./:/var/www
- ./docker-compose/nginx:/etc/nginx/conf.d/
Expand Down

0 comments on commit 423e30b

Please sign in to comment.