Skip to content

Commit

Permalink
Merge pull request #65 from nspalo/feature/DLT-29-restructure
Browse files Browse the repository at this point in the history
feature/DLT-29-restructure
  • Loading branch information
nspalo authored Sep 4, 2023
2 parents 20c121c + dd87f0b commit b23c3e8
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 56 deletions.
4 changes: 2 additions & 2 deletions docker/containers/composer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# - use the image tag php:php-8.1-fpm-alpine
FROM php:php-8.1-fpm-alpine

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

# Add composer bin files path to environment variable
RUN export PATH=$PATH":/usr/bin"
2 changes: 1 addition & 1 deletion docker/containers/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Install MySQL
FROM library/mysql:8.0.30
FROM library/mysql:5.7.22
3 changes: 2 additions & 1 deletion docker/containers/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ FROM php:8.1-fpm-alpine
# Install PHP Extension
RUN apk --no-cache add zip libzip-dev \
&& docker-php-ext-configure zip \
&& docker-php-ext-install zip pdo pdo_mysql \
&& docker-php-ext-install zip mysqli pdo pdo_mysql \
&& docker-php-ext-enable pdo_mysql \
70 changes: 38 additions & 32 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: '3.8'

networks:
web-app:
Expand All @@ -7,7 +7,7 @@ services:
# +----------------------+ #
# | Container: NginX | #
# +----------------------+ #
nginx:
webserver:
networks:
- web-app
container_name: nginx
Expand All @@ -16,57 +16,58 @@ services:
dockerfile: containers/nginx/Dockerfile
image: nginx:nginx-stable-alpine
ports:
- "9100:80"
- "8080:80"
volumes:
- "${PATH_CONFIGS_NGINX}:/etc/nginx/conf.d/default.conf"
- "${PATH_PROJECT_SOURCE}:/var/www/html"
- "${PATH_NGINX_CONFIGS}:/etc/nginx/conf.d/default.conf"
depends_on:
- php
- mysql
- database

# +----------------------+ #
# | Container: PHP | #
# +----------------------+ #
php:
networks:
- web-app
container_name: php
build:
context: .
dockerfile: containers/php/Dockerfile
image: php:php-8.1-fpm-alpine
ports:
- "9000:9000"
volumes:
- "${PATH_PROJECT_SOURCE}:/var/www/html"

# +----------------------+ #
# | Container: MySQL | #
# +----------------------+ #
mysql:
database:
networks:
- web-app
container_name: mysql
command: mysqld --default-authentication-plugin=mysql_native_password
build:
context: .
dockerfile: containers/mysql/Dockerfile
image: mysql:mysql-8.0.30
image: mysql:mysql-${DB_VERSION}
# command: mysqld --default-authentication-plugin=mysql_native_password
restart: unless-stopped
tty: true
ports:
- "3306:3306"
env_file:
- ${PATH_ENV_CONFIGS}/${SYS_ENV}.env
- ${PATH_ENVIRONMENTS}/${SYS_ENV}.env
volumes:
- "${DB_VOLUME}:/var/lib/mysql"
environment:
SERVICE_TAGS: dev
SERVICE_NAME: mysql
# ---- Database Credentials ----
# MYSQL_DATABASE: "${DB_NAME}"
# MYSQL_USER: "${DB_USERNAME}"
# MYSQL_PASSWORD: "${DB_PASSWORD}"
# MYSQL_ROOT_PASSWORD: "${DB_PASSWORD_ROOT}"
SERVICE_TAGS: dev
SERVICE_NAME: mysql

# +----------------------+ #
# | Container: PHP | #
# +----------------------+ #
php:
networks:
- web-app
container_name: php
build:
context: .
dockerfile: containers/php/Dockerfile
image: php:php-8.1-fpm-alpine
ports:
- "9000:9000"
volumes:
- "${PATH_PROJECT_SOURCE}:/var/www/html"

# +----------------------+ #
# | Container: Composer | #
Expand All @@ -78,10 +79,12 @@ services:
build:
context: .
dockerfile: containers/composer/Dockerfile
image: composer:composer-2.1.5
image: composer:composer-2.6.1
working_dir: /var/www/html
volumes:
- "${PATH_PROJECT_SOURCE}:/var/www/html"
depends_on:
- php
entrypoint: ['composer']

# +----------------------+ #
Expand All @@ -108,12 +111,15 @@ services:
context: .
dockerfile: containers/php/Dockerfile
image: artisan:laravel-8
links:
- php
- database
env_file:
- ${PATH_ENV_CONFIGS}/config.env
- ${PATH_ENV_CONFIGS}/${SYS_ENV}.env
- ${PATH_ENVIRONMENTS}/${SYS_ENV}.env
working_dir: /var/www/html
volumes:
- "${PATH_PROJECT_SOURCE}:/var/www/html"
depends_on:
- mysql
entrypoint: ['/var/www/html/artisan']
- php
- database
entrypoint: ['php', '/var/www/html/artisan']
17 changes: 9 additions & 8 deletions docker/environments/config.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
# Docker Environment Config
#============================

# ENVIROMENT
# SYSTEM VARIABLES
SYS_ENV=local

# DIRECTORIES / VOLUMES / PATHS
# PATHS / DIRECTORIES / VOLUMES
PATH_CONTAINERS=./containers
PATH_ENVIRONMENTS=./environments
PATH_VOLUMES=./volumes

PATH_PROJECT_SOURCE=../src
PATH_NGINX=./containers/nginx
PATH_NGINX_CONFIGS=${PATH_NGINX}/conf.d/default.conf
PATH_ENV_CONFIGS=./environments
PATH_DATABASE=./volumes/mysql
PATH_CONFIGS_NGINX=${PATH_CONTAINERS}/nginx/conf.d/default.conf

# DATABASE
DB_DRIVER=mysql
DB_VERSION=8.0.30
DB_PORT=3306
DB_VOLUME=${PATH_DATABASE}/${DB_DRIVER}_${DB_VERSION}
DB_VERSION=5.7.22
DB_VOLUME=${PATH_VOLUMES}/${DB_DRIVER}/${DB_DRIVER}_${DB_VERSION}
2 changes: 1 addition & 1 deletion docker/environments/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
MYSQL_DATABASE=db_docker_laravel
MYSQL_USER=dbUserDev
MYSQL_PASSWORD=dbUserDev123
MYSQL_ROOT_PASSWORD=dbUserRoot123
MYSQL_ROOT_PASSWORD=dbUserRoot123
9 changes: 9 additions & 0 deletions docker/environments/prod.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Docker Environment - Production
#============================

# DATABASE
MYSQL_DATABASE=
MYSQL_USER=
MYSQL_PASSWORD=
MYSQL_ROOT_PASSWORD=
9 changes: 9 additions & 0 deletions docker/environments/staging.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Docker Environment - Staging
#============================

# DATABASE
MYSQL_DATABASE=db_docker_laravel
MYSQL_USER=dbUserDev
MYSQL_PASSWORD=dbUserDev123
MYSQL_ROOT_PASSWORD=dbUserRoot123
8 changes: 0 additions & 8 deletions scripts/docker-compose.sh

This file was deleted.

4 changes: 1 addition & 3 deletions scripts/prune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

set -eo pipefail

#docker rmi -f $(docker images -q)
#docker rmi $(docker images)
#docker rmi $(docker images -qf dangling=true);
# Delete All Images
docker system prune -a --force
docker ps
docker images

0 comments on commit b23c3e8

Please sign in to comment.