Niet weggooien van images 2
This commit is contained in:
27
docker/compose.override.yaml
Normal file
27
docker/compose.override.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
php:
|
||||
environment:
|
||||
XDEBUG_MODE: off
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
depends_on:
|
||||
- mailer
|
||||
|
||||
###> symfony/mercure-bundle ###
|
||||
mercure:
|
||||
ports:
|
||||
- "80"
|
||||
###< symfony/mercure-bundle ###
|
||||
|
||||
###> symfony/mailer ###
|
||||
mailer:
|
||||
image: axllent/mailpit
|
||||
ports:
|
||||
- "1025:1025"
|
||||
- "8025:8025"
|
||||
environment:
|
||||
MP_SMTP_AUTH_ACCEPT_ANY: 1
|
||||
MP_SMTP_AUTH_ALLOW_INSECURE: 1
|
||||
###< symfony/mailer ###
|
||||
133
docker/compose.yaml
Normal file
133
docker/compose.yaml
Normal file
@@ -0,0 +1,133 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
php:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: php/Dockerfile
|
||||
args:
|
||||
USER_ID: ${USER_ID:-1000}
|
||||
GROUP_ID: ${GROUP_ID:-1000}
|
||||
container_name: escapepage-php
|
||||
volumes:
|
||||
- ../:/var/www/html:delegated
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
environment:
|
||||
APP_ENV: ${APP_ENV:-dev}
|
||||
depends_on:
|
||||
- database
|
||||
- mercure
|
||||
networks:
|
||||
backend:
|
||||
ipv4_address: 172.20.0.10
|
||||
restart: unless-stopped
|
||||
|
||||
php-worker:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: php/Dockerfile
|
||||
args:
|
||||
USER_ID: ${USER_ID:-1000}
|
||||
GROUP_ID: ${GROUP_ID:-1000}
|
||||
container_name: escapepage-php-worker
|
||||
volumes:
|
||||
- ../:/var/www/html:delegated
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
environment:
|
||||
APP_ENV: ${APP_ENV:-dev}
|
||||
depends_on:
|
||||
- database
|
||||
- mercure
|
||||
command: ["php", "bin/console", "messenger:consume", "async", "-vv"]
|
||||
networks:
|
||||
backend:
|
||||
ipv4_address: 172.20.0.11
|
||||
restart: unless-stopped
|
||||
|
||||
nginx:
|
||||
image: nginx:1.29.4-alpine
|
||||
container_name: escapepage-nginx
|
||||
ports:
|
||||
- "8080:80"
|
||||
- "8443:443"
|
||||
volumes:
|
||||
- ../:/var/www/html:ro
|
||||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./nginx/ssl:/etc/nginx/ssl:ro
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
depends_on:
|
||||
- php
|
||||
networks:
|
||||
backend:
|
||||
ipv4_address: 172.20.0.12
|
||||
restart: unless-stopped
|
||||
|
||||
mailer:
|
||||
image: axllent/mailpit:latest
|
||||
container_name: escapepage-mailer
|
||||
ports:
|
||||
- "8025:8025"
|
||||
volumes:
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
networks:
|
||||
backend:
|
||||
ipv4_address: 172.20.0.13
|
||||
restart: unless-stopped
|
||||
|
||||
mercure:
|
||||
image: dunglas/mercure:v0.21
|
||||
container_name: escapepage-mercure
|
||||
environment:
|
||||
SERVER_NAME: ":80"
|
||||
MERCURE_PUBLISHER_JWT_KEY: ${MERCURE_JWT_SECRET}
|
||||
MERCURE_SUBSCRIBER_JWT_KEY: ${MERCURE_JWT_SECRET}
|
||||
MERCURE_CORS_ALLOWED_ORIGINS: ${MERCURE_CORS_ALLOWED_ORIGINS:-http://localhost:8080}
|
||||
MERCURE_PUBLISH_ALLOWED_ORIGINS: ${MERCURE_CORS_ALLOWED_ORIGINS:-http://localhost:8080}
|
||||
MERCURE_EXTRA_DIRECTIVES: |
|
||||
cors_origins ${MERCURE_CORS_ALLOWED_ORIGINS:-http://localhost:8080}
|
||||
# Allow anonymous subscribers in dev only
|
||||
anonymous
|
||||
ports:
|
||||
- "8090:80"
|
||||
volumes:
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
networks:
|
||||
backend:
|
||||
ipv4_address: 172.20.0.14
|
||||
restart: unless-stopped
|
||||
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
image: mysql:8.0
|
||||
container_name: escapepage-db
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DB_NAME:-app}
|
||||
MYSQL_USER: ${DB_USER:-app}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD:-!ChangeMe!}
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-p${MYSQL_ROOT_PASSWORD:-root}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
command: ["--default-authentication-plugin=mysql_native_password", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
||||
volumes:
|
||||
- ../var/volumes/db:/var/lib/mysql:rw
|
||||
- ./mysql/init:/docker-entrypoint-initdb.d:ro
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
# Uncomment the two lines below if you need to access MySQL from your host (workbench, etc.)
|
||||
ports:
|
||||
- "3306:3306"
|
||||
networks:
|
||||
backend:
|
||||
ipv4_address: 172.20.0.15
|
||||
restart: unless-stopped
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
networks:
|
||||
backend:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.20.0.0/16
|
||||
@@ -4,11 +4,10 @@ set -euo pipefail
|
||||
# Script to completely restart the project as requested
|
||||
|
||||
echo "Stopping and removing containers..."
|
||||
dc() { (cd "$(dirname "$0")/.." && docker-compose "$@"); }
|
||||
dc down
|
||||
docker compose -f compose.yaml -f compose.override.yaml --env-file ../.env down --remove-orphans
|
||||
|
||||
echo "Clearing Docker build cache..."
|
||||
docker builder prune -f
|
||||
docker builder prune -af
|
||||
|
||||
echo "Running setup script..."
|
||||
"$(dirname "$0")/setup.sh" --no-build
|
||||
./setup.sh --no-build
|
||||
|
||||
@@ -18,17 +18,17 @@ set -euo pipefail
|
||||
ROOT_DIR=$(cd "$(dirname "$0")"/.. && pwd)
|
||||
DOCKER_DIR="$ROOT_DIR/docker"
|
||||
# Determine the docker-compose command
|
||||
if command -v docker-compose >/dev/null 2>&1; then
|
||||
DOCKER_COMPOSE="docker-compose"
|
||||
elif docker compose version >/dev/null 2>&1; then
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
DOCKER_COMPOSE="docker compose"
|
||||
elif command -v docker-compose >/dev/null 2>&1; then
|
||||
DOCKER_COMPOSE="docker-compose"
|
||||
else
|
||||
echo "Error: Neither 'docker-compose' nor 'docker compose' was found. Please install Docker Compose." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Helper to run docker compose from the project root
|
||||
dc() { (cd "$ROOT_DIR" && $DOCKER_COMPOSE "$@"); }
|
||||
# Helper to run docker compose from the docker directory
|
||||
dc() { (cd "$DOCKER_DIR" && $DOCKER_COMPOSE -f compose.yaml -f compose.override.yaml --env-file ../.env "$@"); }
|
||||
|
||||
REBUILD=1
|
||||
RECREATE=0
|
||||
@@ -132,12 +132,12 @@ Open the app: $APP_URL
|
||||
Mailpit (dev): $MAILPIT_URL
|
||||
|
||||
Common commands:
|
||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE logs -f nginx)
|
||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE logs -f php)
|
||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE logs -f php-worker)
|
||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE exec php bash)
|
||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE exec php npm run watch)
|
||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE down)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f nginx)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php-worker)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php bash)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php npm run watch)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE down)
|
||||
|
||||
You can re-run this script any time. Use --no-build to skip rebuilding images.
|
||||
EOT
|
||||
|
||||
Reference in New Issue
Block a user