Skip to content

Commit

Permalink
Set always restart docker-compose for nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroc0d3 committed Nov 27, 2022
1 parent eb176f3 commit f9fca17
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
55 changes: 42 additions & 13 deletions compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ volumes:
o: bind
type: none
device: ${DATA_MARIADB:-/opt/data/docker/mariadb10.5}
vol_phpfpm:
vol_laravel:
driver: ${VOLUMES_DRIVER:-local}
driver_opts:
o: bind
type: none
device: ${DATA_PHPFPM:-/opt/data/docker/phpfpm}
device: ${DATA_LARAVEL:-/opt/data/docker/laravel}
vol_nginx:
driver: ${VOLUMES_DRIVER:-local}
driver_opts:
o: bind
type: none
device: ${DATA_NGINX:-/opt/data/docker/nginx-alpine}

services:
#================================================================================================
Expand Down Expand Up @@ -86,22 +92,23 @@ services:
ipv4_address: ${CONTAINER_IP_PORTAINER:-172.150.150.201}

#================================================================================================
# PHPFPM
# LARAVEL
#================================================================================================
phpfpm:
# image: zeroc0d3/laravel-kubernetes:${LARAVEL_K8S_VERSION:-latest}
laravel:
# image: devopscorner/laravel:${LARAVEL_K8S_VERSION:-latest}
build:
context: .
dockerfile: Dockerfile
container_name: ${CONTAINER_PHPFPM:-devopscorner_phpfpm}
container_name: ${CONTAINER_LARAVEL:-devopscorner_laravel}
links:
- mariadb
restart: unless-stopped
hostname: myphpfpm
hostname: mylaravel
ports:
- "${PORT_PHPFPM:-5300}:9000"
- "${PORT_LARAVEL:-8000}:9000"
volumes:
# - /etc/localtime:/etc/localtime:ro ## Do not use it in mac
- /var/run/docker.sock:/var/run/docker.sock ## Do not use it in k8s
# - ${PHPFPM_TOOLS:-./phpfpm}:/tmp/phpfpm
environment:
- TZ="Asia/Jakarta"
- PHP_VERSION=${PHP_VERSION:-8.1}
Expand All @@ -114,7 +121,7 @@ services:
- DB_USERNAME=${MARIADB_USER:-laravel_user}
- DB_PASSWORD=${MARIADB_PASSWORD:-secretpassword}
healthcheck:
test: "${DOCKER_HEALTHCHECK_PHPFPM:-curl localhost:8000}"
test: "${DOCKER_HEALTHCHECK_LARAVEL:-curl localhost:8000}"
interval: "60s"
timeout: "3s"
start_period: "5s"
Expand All @@ -123,7 +130,7 @@ services:
tty: true
networks:
devopscorner_net:
ipv4_address: ${CONTAINER_IP_PHPFPM:-172.150.150.202}
ipv4_address: ${CONTAINER_IP_LARAVEL:-172.150.150.205}

#================================================================================================
# MARIADB
Expand All @@ -144,8 +151,6 @@ services:
- vol_mariadb:/var/lib/mysql
- ./docker/ubuntu-mariadb/rootfs/etc/my.cnf:/etc/my.cnf
- ./docker/ubuntu-mariadb/rootfs/etc/my.cnf.d/mariadb-server.cnf:/etc/my.cnf.d/mariadb-server.cnf
## Path services ##
- ${SERVICES_TOOLS:-./services}:/tmp/services
environment:
- ENV=local
- TZ="Asia/Jakarta"
Expand All @@ -162,3 +167,27 @@ services:
networks:
devopscorner_net:
ipv4_address: ${CONTAINER_IP_MARIADB:-172.150.150.203}

#================================================================================================
# NGINX ALPINE
#================================================================================================
nginx:
image: nginx:${NGINX_VERSION:-1.23-alpine}
container_name: ${CONTAINER_CICD_ALPINE:-devopscorner_nginx}
restart: always
links:
- laravel
ports:
- "${PORT_NGINX:-5250}:80"
volumes:
#- /etc/localtime:/etc/localtime:ro ## Do not use it in mac
- /var/run/docker.sock:/var/run/docker.sock ## Do not use it in k8s
environment:
- TZ="Asia/Jakarta"
- ALPINE_VERSION=${ALPINE_VERSION:-3.16}
- NGINX_VERSION=${NGINX_VERSION:-1.23}
privileged: true
tty: true
networks:
devopscorner_net:
ipv4_address: ${CONTAINER_IP_NGINX:-172.150.150.213}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ services:
nginx:
image: nginx:${NGINX_VERSION:-1.23-alpine}
container_name: ${CONTAINER_CICD_ALPINE:-devopscorner_nginx}
restart: unless-stopped
restart: always
links:
- laravel
ports:
Expand Down

0 comments on commit f9fca17

Please sign in to comment.