Skip to content

Commit

Permalink
chore: Add scripts to run both backend and frontend Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
zuka-e committed Aug 18, 2024
1 parent 1cda72d commit 1745f7d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 8 deletions.
25 changes: 25 additions & 0 deletions .devcontainer/fullstack/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// https://containers.dev/implementors/json_reference/#compose-specific
{
"dockerComposeFile": [
"${localWorkspaceFolder}/docker-compose.base.yml",
"${localWorkspaceFolder}/docker-compose.fullstack.yml",
"${localWorkspaceFolder}/docker-compose.dev.yml",
"${localWorkspaceFolder}/docker-compose.devcontainer.yml"
],
"initializeCommand": "${localWorkspaceFolder}/.devcontainer/init-env.sh backend,frontend",
"shutdownAction": "none",
"service": "node",
"workspaceFolder": "/var/www/html",
"customizations": {
"vscode": {
"extensions": [
"xdebug.php-debug",
"bmewburn.vscode-intelephense-client",
"amiralizadeh9480.laravel-extra-intellisense",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker"
]
}
}
}
29 changes: 29 additions & 0 deletions docker-compose.fullstack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
services:
nginx:
profiles: ['backend', 'frontend']
environment:
ROOT_DIR: ${CONTAINER_PROJECT_DIR}/backend/public
volumes:
# cf. https://docs.docker.com/compose/compose-file/05-services/#long-syntax-5
# cf. https://hub.docker.com/_/nginx - Using environment variables
- type: bind
source: ./backend/docker/nginx/default.conf
target: /etc/nginx/templates/default.conf.template
read_only: true
- type: bind
source: ./backend/docker/nginx/${ENV}.conf
target: /etc/nginx/templates/${ENV}.conf.template
read_only: true
- type: bind
source: ./backend/public
target: ${CONTAINER_PROJECT_DIR}/backend/public
read_only: true
- type: bind
source: ./frontend/docker/nginx/frontend.conf
target: /etc/nginx/templates/frontend.conf.template
read_only: true
depends_on:
php-fpm:
condition: service_started
node:
condition: service_started
10 changes: 2 additions & 8 deletions docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ resolve_env ".env.docker-compose"
resolve_env "./backend/.env" &&
docker compose \
-f docker-compose.base.yml \
-f docker-compose.backend.yml \
-f docker-compose.fullstack.yml \
-f docker-compose.dev.yml \
--profile backend \
--profile frontend \
"$@"

docker compose \
-f docker-compose.base.yml \
-f docker-compose.frontend.yml \
-f docker-compose.dev.yml \
--profile frontend \
"$@"

0 comments on commit 1745f7d

Please sign in to comment.