-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portable devcontainer #674
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
build: | ||
npm install | ||
composer install | ||
npm run dev | ||
cp .env.example .env | ||
php artisan key:generate | ||
php artisan migrate | ||
|
||
seed: | ||
php artisan db:seed | ||
|
||
serve: | ||
php artisan serve --host=0.0.0.0 | ||
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,56 +1,32 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# For more information: https://laravel.com/docs/sail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
version: '3' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
services: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
laravel.test: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
build: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
context: ./vendor/laravel/sail/runtimes/8.2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dockerfile: Dockerfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
args: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
WWWGROUP: '${WWWGROUP}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: sail-8.2/app | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
extra_hosts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- 'host.docker.internal:host-gateway' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '${APP_PORT:-80}:80' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
environment: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
WWWUSER: '${WWWUSER}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LARAVEL_SAIL: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '.:/var/www/html' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
networks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- sail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
depends_on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: 'mysql/mysql-server:8.0' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '${FORWARD_DB_PORT:-3306}:3306' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
environment: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_ROOT_HOST: '%' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_DATABASE: '${DB_DATABASE}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_USER: '${DB_USERNAME}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_PASSWORD: '${DB_PASSWORD}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_ALLOW_EMPTY_PASSWORD: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- 'sail-mysql:/var/lib/mysql' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
networks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- sail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
healthcheck: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
test: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- CMD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- mysqladmin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- ping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '-p${DB_PASSWORD}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
retries: 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
timeout: 5s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
networks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sail: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
driver: bridge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container_name: mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: mysql:8.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
environment: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_DATABASE: 'mars' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_USER: 'mars' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_PASSWORD: 'secret' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MYSQL_ROOT_PASSWORD: 'secret' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '127.0.0.1:3307:3306' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
expose: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '3306' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- mars_db:/var/lib/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mars_dev: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+4
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider using environment variables for MySQL credentials I say, it would be rather prudent to move these credentials to a Here's a proper British way to do it: mysql:
container_name: mysql
image: mysql:8.3
environment:
- MYSQL_DATABASE: 'mars'
- MYSQL_USER: 'mars'
- MYSQL_PASSWORD: 'secret'
- MYSQL_ROOT_PASSWORD: 'secret'
+ MYSQL_DATABASE: ${MYSQL_DATABASE:-mars}
+ MYSQL_USER: ${MYSQL_USER:-mars}
+ MYSQL_PASSWORD: ${MYSQL_PASSWORD:-secret}
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-secret} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container_name: mars_dev | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: mars_image:latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pull_policy: never | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
build: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
context: ./docker-dev-setup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
depends_on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- ".:/workspace/mars" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- '127.0.0.1:8000:8000' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sail-mysql: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
driver: local | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mars_db: |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Restrict service binding to localhost
I must point out that binding to 0.0.0.0 might be a tad too permissive. Since we're in a development container, we should restrict this to localhost for improved security.
📝 Committable suggestion