Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM php:7.2-fpm

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
libzip-dev \
-y mariadb-client

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

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

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

58 changes: 58 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: "3.7"
services:
app:
build:
args:
user: sammy
uid: 1000
context: ./
dockerfile: Dockerfile.dev
working_dir: /var/www/
environment:
- COMPOSER_MEMORY_LIMIT=-1
depends_on:
- db
volumes:
- ./:/var/www
networks:
- lahmi

db:
image: mysql:5.7
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_USER: ${DB_USERNAME}
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql
- ./docker-compose/mysql/my.cnf:/etc/mysql/my.cnf
- ./docker-compose/mysql/init:/docker-entrypoint-initdb.d
ports:
- 3307:3306
networks:
- lahmi

nginx:
image: nginx:alpine
ports:
- 8005:80
depends_on:
- db
- app
volumes:
- ./:/var/www
- ./docker-compose/nginx:/etc/nginx/conf.d/
networks:
- lahmi

networks:
lahmi:
driver: bridge

volumes:
dbdata:
driver: local

7 changes: 7 additions & 0 deletions docker-compose/mysql/init/01-databases.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# create databases
CREATE DATABASE IF NOT EXISTS `local_laravel`;

# create local_developer user and grant rights
CREATE USER 'local_developer'@'db' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON *.* TO 'local_developer'@'%';

4 changes: 4 additions & 0 deletions docker-compose/mysql/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[mysqld]
general_log = 1
general_log_file = /var/lib/mysql/general.log

21 changes: 21 additions & 0 deletions docker-compose/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}

2 changes: 1 addition & 1 deletion resources/views/User/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</thead>
<tbody>
@foreach ($charts as $chart)
<p hidden>{{$total += $chart->subtotal;}}</p>
<p hidden>{{$total += $chart->subtotal}}</p>
@endforeach
<td colspan="2">Total belanja : <h3>{{ $total}}</h3></td>
</tbody>
Expand Down