-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Docker] Add docker support for Sylius 2.0 (#451)
- Loading branch information
Showing
8 changed files
with
163 additions
and
115 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
**/*.log | ||
**/*.md | ||
**/*.php~ | ||
**/._* | ||
**/.dockerignore | ||
**/.DS_Store | ||
**/.git/ | ||
**/.gitattributes | ||
**/.github | ||
**/.gitignore | ||
**/.gitkeep | ||
**/.gitmodules | ||
**/.idea | ||
**/Dockerfile | ||
**/Thumbs.db | ||
**/docker-compose*.yaml | ||
**/docker-compose*.yml | ||
.editorconfig | ||
.php_cs.cache | ||
.travis.yml | ||
composer.phar | ||
docker/mysql/data/ | ||
etc/build/* | ||
node_modules/ | ||
var/* | ||
vendor/ | ||
public/assets/ | ||
public/build/ | ||
public/bundles/ | ||
public/css/ | ||
public/js/ | ||
public/media/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
phpunit: | ||
vendor/bin/phpunit | ||
.PHONY: run | ||
|
||
phpspec: | ||
vendor/bin/phpspec run --ansi --no-interaction -f dot | ||
DOCKER_COMPOSE ?= docker compose | ||
DOCKER_USER ?= "$(shell id -u):$(shell id -g)" | ||
ENV ?= "dev" | ||
|
||
phpstan: | ||
vendor/bin/phpstan analyse | ||
init: | ||
@make -s docker-compose-check | ||
@if [ ! -e compose.override.yml ]; then \ | ||
cp compose.override.dist.yml compose.override.yml; \ | ||
fi | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php composer install --no-interaction --no-scripts | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm nodejs | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d | ||
|
||
behat: | ||
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress | ||
run: | ||
@make -s up | ||
|
||
install: | ||
composer install --no-interaction --no-scripts | ||
debug: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) -f compose.yml -f compose.override.yml -f compose.debug.yml up -d | ||
|
||
up: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d | ||
|
||
backend: | ||
tests/Application/bin/console sylius:install --no-interaction | ||
tests/Application/bin/console sylius:fixtures:load default --no-interaction | ||
down: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down | ||
|
||
install: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php bin/console sylius:install -s default -n | ||
|
||
frontend: | ||
(cd tests/Application && yarn install --pure-lockfile) | ||
(cd tests/Application && GULP_ENV=prod yarn build) | ||
clean: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down -v | ||
|
||
init: install backend frontend | ||
php-shell: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) exec php sh | ||
|
||
ci: init phpstan phpunit phpspec behat | ||
node-shell: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs sh | ||
|
||
integration: init phpunit behat | ||
node-watch: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs "npm run watch" | ||
|
||
static: install phpspec phpstan | ||
docker-compose-check: | ||
@$(DOCKER_COMPOSE) version >/dev/null 2>&1 || (echo "Please install docker compose binary or set DOCKER_COMPOSE=\"docker-compose\" for legacy binary" && exit 1) | ||
@echo "You are using \"$(DOCKER_COMPOSE)\" binary" | ||
@echo "Current version is \"$$($(DOCKER_COMPOSE) version)\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
services: | ||
php: | ||
image: ghcr.io/sylius/sylius-php:8.3-fixuid-xdebug-alpine | ||
user: ${DOCKER_USER:-1000:1000} | ||
depends_on: | ||
mysql: | ||
condition: service_healthy | ||
environment: | ||
# You can move these environment variables to your .env.local file | ||
APP_ENV: ${ENV:-prod} | ||
APP_SECRET: EDITME | ||
DATABASE_URL: "mysql://root@mysql/sylius_%kernel.environment%" | ||
MAILER_DSN: smtp://mailhog:1025 | ||
MESSENGER_TRANSPORT_DSN: doctrine://default | ||
SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN: doctrine://default | ||
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN: doctrine://default?queue_name=main_failed | ||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN: doctrine://default?queue_name=catalog_promotion_removal | ||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN: doctrine://default?queue_name=catalog_promotion_removal_failed | ||
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN: sync:// | ||
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN: sync:// | ||
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC} | ||
XDEBUG_MODE: debug | ||
XDEBUG_CONFIG: >- | ||
client_host=host.docker.internal | ||
client_port=9003 | ||
# This should correspond to the server declared in PHPStorm `Preferences | Languages & Frameworks | PHP | Servers` | ||
# Then PHPStorm will use the corresponding path mappings | ||
PHP_IDE_CONFIG: serverName=sylius | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
volumes: | ||
- .:/srv/sylius:rw,cached | ||
# if you develop on Linux, you may use a bind-mounted host directory instead | ||
# - ./var:/srv/sylius/var:rw | ||
- ./public:/srv/sylius/public:rw,delegated | ||
# if you develop on Linux, you may use a bind-mounted host directory instead | ||
# - ./public/media:/srv/sylius/public/media:rw | ||
- public-media:/srv/sylius/public/media:rw | ||
mysql: | ||
volumes: | ||
- mysql-data:/var/lib/mysql:rw | ||
ports: | ||
- "3306:3306" | ||
nginx: | ||
environment: | ||
WORKING_DIR: /srv/sylius/tests/Application | ||
volumes: | ||
- .:/srv/sylius:ro | ||
# if you develop on Linux, you may use a bind-mounted host directory instead | ||
# - ./public/media:/srv/sylius/public/media:ro | ||
ports: | ||
- "80:80" | ||
nodejs: | ||
image: node:${NODE_VERSION:-22}-alpine | ||
user: ${DOCKER_USER:-1000:1000} | ||
working_dir: /srv/sylius | ||
entrypoint: [ "/bin/sh","-c" ] | ||
command: | ||
- | | ||
cd tests/Application | ||
yarn install | ||
yarn build | ||
volumes: | ||
- .:/srv/sylius:rw,cached | ||
- ./public:/srv/sylius/public:rw,delegated | ||
mailhog: | ||
ports: | ||
- "8025:8025" | ||
|
||
volumes: | ||
mysql-data: | ||
public-media: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
services: | ||
php: | ||
image: ghcr.io/sylius/sylius-php:8.3-alpine | ||
mysql: | ||
image: mysql:8.4 | ||
platform: linux/amd64 | ||
healthcheck: | ||
test: '/usr/bin/mysql --execute "SHOW databases;"' | ||
timeout: 3s | ||
interval: 1s | ||
retries: 10 | ||
environment: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: 1 | ||
cap_add: | ||
- SYS_NICE # prevent "mbind: Operation not permitted" errors | ||
nginx: | ||
image: ghcr.io/sylius/sylius-nginx:latest | ||
depends_on: | ||
- php | ||
mailhog: | ||
# do not use in production! | ||
image: mailhog/mailhog:latest |
This file was deleted.
Oops, something went wrong.