Skip to content

Commit

Permalink
Merge pull request #14 from vuongxuongminh/3.x
Browse files Browse the repository at this point in the history
Bump template to 3.x
  • Loading branch information
vuongxuongminh authored Apr 30, 2021
2 parents 7adbdc8 + 3e7255f commit 58ceee7
Show file tree
Hide file tree
Showing 85 changed files with 336 additions and 8,050 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/.github export-ignore
/.gitattributes export-ignore
/screenshots export-ignore
/.gitattributes export-ignore
38 changes: 23 additions & 15 deletions .github/workflows/dockerpublish.yml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
name: Docker
name: CI

on: push

on:
push:
branches:
- master
env:
PHP_IMAGE: vuongxuongminh/docker-helm-symfony-php
NGINX_IMAGE: vuongxuongminh/docker-helm-symfony-nginx
IMAGE: vuongxuongminh/docker-helm-symfony

jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run setup
run: docker-compose run --rm setup
- name: Up services
run: docker-compose up -d
- name: Wait seconds
run: sleep 5
- name: Test with curl
run: curl http://localhost | grep "Welcome to Symfony!"
build:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [test]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Log into registry
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u ${{ github.actor }} --password-stdin

- name: Build images
run: |
docker-compose -f docker-compose.yaml -f docker-compose.override.yaml build
docker-compose -f docker-compose.yaml -f docker-compose.prod.yaml build
docker-compose -f docker-compose.yaml -f docker-compose.override.yaml build fpm
docker-compose -f docker-compose.yaml -f docker-compose.prod.yaml build fpm
- name: Push image
run: |
docker-compose -f docker-compose.yaml -f docker-compose.override.yaml push
docker-compose -f docker-compose.yaml -f docker-compose.prod.yaml push
docker-compose -f docker-compose.yaml -f docker-compose.override.yaml push fpm
docker-compose -f docker-compose.yaml -f docker-compose.prod.yaml push fpm
149 changes: 25 additions & 124 deletions README.md

Large diffs are not rendered by default.

122 changes: 8 additions & 114 deletions docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,141 +5,35 @@ x-build:
APP_ENV: 'dev'
APP_DEBUG: '1'
- &build-cache
- ${PHP_IMAGE:-vuongxuongminh/docker-helm-symfony-php}:dev
- ${NGINX_IMAGE:-vuongxuongminh/docker-helm-symfony-nginx}:dev
- ${IMAGE:-vuongxuongminh/docker-helm-symfony}:dev

services:
mysql:
image: mysql:8
command: ['--default-authentication-plugin=mysql_native_password']
environment:
MYSQL_DATABASE: 'test'
MYSQL_ROOT_PASSWORD: 'root'
volumes:
- db-data:/var/lib/mysql

setup:
image: ${PHP_IMAGE:-vuongxuongminh/docker-helm-symfony-php}:dev
image: ${IMAGE:-vuongxuongminh/docker-helm-symfony}:dev
command: ['setup']
build:
context: .
dockerfile: ./docker/Dockerfile
target: php
dockerfile: ./docker/fpm/Dockerfile
cache_from: *build-cache
args:
<< : *build-args
environment:
<< : *build-args
volumes:
- ./symfony:/symfony:rw
depends_on:
- mysql
- ./symfony:/symfony

fpm:
image: ${PHP_IMAGE:-vuongxuongminh/docker-helm-symfony-php}:dev
image: ${IMAGE:-vuongxuongminh/docker-helm-symfony-php}:dev
build:
cache_from: *build-cache
args:
<< : *build-args
environment:
<< : *build-args
volumes:
- ./symfony:/symfony:rw,cached
- fpm-log-data:/symfony/var/log:rw
depends_on:
- rabbitmq
- mailhog
- mysql

supervisor:
image: ${PHP_IMAGE:-vuongxuongminh/docker-helm-symfony-php}:dev
build:
cache_from: *build-cache
args:
<< : *build-args
environment:
<< : *build-args
SUPERVISOR_USERNAME: root
SUPERVISOR_PASSWORD: root
volumes:
- ./symfony:/symfony:rw,cached
- supervisor-log-data:/symfony/var/log:rw
ports:
- target: 9000
published: 9000
protocol: tcp
depends_on:
- rabbitmq
- mailhog
- mysql
- ./symfony:/symfony

nginx:
image: ${NGINX_IMAGE:-vuongxuongminh/docker-helm-symfony-nginx}:dev
build:
cache_from: *build-cache
args:
<< : *build-args
environment:
# `fpm` container name use to pass request via `fastcgi_pass`, it useful when you want to change `fpm` service name or container name of it.
FPM_SERVICE: fpm
volumes:
- ./symfony/public:/symfony/public:rw,cached
- nginx-log-data:/var/log/nginx:rw
ports:
- target: 80
published: 80
protocol: tcp
depends_on:
- fpm

mailhog:
image: mailhog/mailhog
ports:
- target: 8025
published: 8025
protocol: tcp

rabbitmq:
image: rabbitmq:3.8-management-alpine
ports:
- target: 15672
published: 15672
protocol: tcp

grafana:
image: grafana/grafana
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
volumes:
- grafana-data:/var/lib/grafana
- ./docker/grafana/datasources:/etc/grafana/provisioning/datasources:ro
- ./docker/grafana/dashboards:/etc/grafana/provisioning/dashboards:ro
depends_on:
- promtail
ports:
- target: 3000
published: 3000
protocol: tcp

loki:
image: grafana/loki
command: -config.file=/etc/loki/local-config.yaml

promtail:
image: grafana/promtail
depends_on:
- loki
volumes:
- fpm-log-data:/var/log/fpm
- nginx-log-data:/var/log/nginx
- supervisor-log-data:/var/log/supervisor
- ./docker/promtail:/etc/promtail:ro
command: -config.file=/etc/promtail/config.yaml

volumes:
db-data: {}
grafana-data: {}
fpm-log-data: {}
nginx-log-data: {}
supervisor-log-data: {}
- ./symfony/public:/symfony/public
- ./docker/nginx/default.conf:/opt/bitnami/nginx/conf/server_blocks/default.conf:ro
19 changes: 2 additions & 17 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,11 @@ x-build:
APP_ENV: 'prod'
APP_DEBUG: '0'
- &build-cache
- ${PHP_IMAGE:-vuongxuongminh/docker-helm-symfony-php}:prod
- ${NGINX_IMAGE:-vuongxuongminh/docker-helm-symfony-nginx}:prod
- ${IMAGE:-vuongxuongminh/docker-helm-symfony}:prod

services:
fpm:
image: ${PHP_IMAGE:-vuongxuongminh/docker-helm-symfony-php}:prod
build:
cache_from: *build-cache
args:
<< : *build-args

supervisor:
image: ${PHP_IMAGE:-vuongxuongminh/docker-helm-symfony-php}:prod
build:
cache_from: *build-cache
args:
<< : *build-args

nginx:
image: ${NGINX_IMAGE:-vuongxuongminh/docker-helm-symfony-nginx}:prod
image: ${IMAGE:-vuongxuongminh/docker-helm-symfony}:prod
build:
cache_from: *build-cache
args:
Expand Down
34 changes: 10 additions & 24 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,24 @@ services:
command: ['fpm']
build:
context: .
dockerfile: ./docker/Dockerfile
target: php
dockerfile: ./docker/fpm/Dockerfile
healthcheck:
test: ['CMD', 'docker-healthcheck', 'fpm']
interval: 10s
timeout: 3s
retries: 3
start_period: 30s

supervisor:
command: ['supervisor']
build:
context: .
dockerfile: ./docker/Dockerfile
target: php
healthcheck:
test: ['CMD', 'docker-healthcheck', 'supervisor']
interval: 10s
timeout: 3s
retries: 3
start_period: 30s
start_period: 10s
network_mode: service:nginx

nginx:
build:
context: .
dockerfile: ./docker/Dockerfile
target: nginx
image: bitnami/nginx
healthcheck:
test: ['CMD', 'docker-healthcheck']
test: ['CMD', 'curl', '-f', 'http://localhost:8080/status']
interval: 10s
timeout: 3s
retries: 3
start_period: 30s
depends_on:
- fpm
start_period: 10s
ports:
- target: 8080
published: 80
protocol: tcp
Loading

0 comments on commit 58ceee7

Please sign in to comment.