-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The new concept allows to setup environment with just one command 🚀 ```bash make init # initialize Sylius installation with required dependencies ENV=test make run # to change the environment to test make debug # to run php container with xDebug + mailhog ``` ### Requirements - Docker - Makefile ### used dependencies - https://github.com/sylius/docker-images - ready to use Sylius images - https://github.com/boxboat/fixuid - fixes user ID between local machine and docker container (required for Linux)
- Loading branch information
Showing
17 changed files
with
134 additions
and
406 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.PHONY: run | ||
|
||
DOCKER_USER ?= "$(shell id -u):$(shell id -g)" | ||
ENV ?= "dev" | ||
|
||
init: | ||
@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 | ||
make install | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) docker-compose up -d | ||
|
||
run: | ||
make up | ||
|
||
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 | ||
|
||
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 | ||
|
||
clean: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) docker-compose down -v | ||
|
||
php-shell: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) docker-compose exec php sh | ||
|
||
node-shell: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) docker-compose run --rm -i nodejs sh | ||
|
||
node-watch: | ||
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) docker-compose run --rm -i nodejs "npm run watch" |
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,71 @@ | ||
version: "3.8" | ||
services: | ||
php: | ||
image: ghcr.io/sylius/sylius-php:8.2-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_DEBUG: 0 | ||
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 | ||
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC} | ||
XDEBUG_MODE: debug | ||
XDEBUG_CONFIG: >- | ||
client_host=host.docker.internal | ||
client_port=9003 | ||
log=/dev/stdout | ||
# 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: | ||
- "8051:3306" | ||
nginx: | ||
volumes: | ||
- ./public:/srv/sylius/public:ro | ||
# if you develop on Linux, you may use a bind-mounted host directory instead | ||
# - ./public/media:/srv/sylius/public/media:ro | ||
- public-media:/srv/sylius/public/media:ro,nocopy | ||
ports: | ||
- "8050:80" | ||
nodejs: | ||
image: node:${NODE_VERSION:-18}-alpine | ||
user: ${DOCKER_USER:-1000:1000} | ||
working_dir: /srv/sylius | ||
entrypoint: [ "/bin/sh","-c" ] | ||
command: | ||
- | | ||
npm install | ||
npm run build | ||
volumes: | ||
- .:/srv/sylius:rw,cached | ||
- ./public:/srv/sylius/public:rw,delegated | ||
mailhog: | ||
ports: | ||
- "8052: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,20 @@ | ||
services: | ||
php: | ||
image: ghcr.io/sylius/sylius-php:8.2-alpine | ||
mysql: | ||
image: mysql:8.0 | ||
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 | ||
mailhog: | ||
# do not use in production! | ||
image: mailhog/mailhog:latest |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.