Skip to content
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

Add new Docker concept #935

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/docker-compose.override.yaml
/docker-compose.override.yml
/compose.override.yaml
/compose.override.yml
/docker/mysql/data/

###> symfony/framework-bundle ###
Expand Down
40 changes: 40 additions & 0 deletions Makefile
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

yarn-watch:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) docker-compose run --rm -i nodejs "yarn watch"
Wojdylak marked this conversation as resolved.
Show resolved Hide resolved
22 changes: 22 additions & 0 deletions compose.debug.yml
Wojdylak marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.8"
services:
php:
image: ghcr.io/sylius/sylius-php:8.2-fixuid-xdebug-alpine
environment:
APP_DEBUG: 1
MAILER_URL: smtp://mailhog:1025
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"
mailhog:
# do not use in production!
image: mailhog/mailhog:latest
ports:
- "8025:8025"
56 changes: 56 additions & 0 deletions compose.override.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: "3.8"
services:
php:
image: ghcr.io/sylius/sylius-php:8.2-fixuid-alpine
user: ${DOCKER_USER:-1000:1000}
depends_on:
mysql:
condition: service_healthy
environment:
APP_DEBUG: 0
APP_ENV: ${ENV:-prod}
APP_SECRET: EDITME
DATABASE_URL: "mysql://root@mysql/sylius_%kernel.environment%"
MAILER_URL: null://null
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}
Wojdylak marked this conversation as resolved.
Show resolved Hide resolved
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:
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:
- "80:80"
nodejs:
image: node:${NODE_VERSION:-16}-alpine
Wojdylak marked this conversation as resolved.
Show resolved Hide resolved
user: ${DOCKER_USER:-1000:1000}
working_dir: /srv/sylius
entrypoint: [ "/bin/sh","-c" ]
command:
- |
yarn install
yarn build
volumes:
- .:/srv/sylius:rw,cached
- ./public:/srv/sylius/public:rw,delegated
volumes:
mysql-data:
public-media:
17 changes: 17 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
php:
image: ghcr.io/sylius/sylius-php:8.2-alpine
mysql:
image: mysql:5.7 # Sylius is fully working on mysql 8.0 version
Wojdylak marked this conversation as resolved.
Show resolved Hide resolved
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
118 changes: 0 additions & 118 deletions docker-compose.prod.yml

This file was deleted.

104 changes: 0 additions & 104 deletions docker-compose.yml

This file was deleted.

2 changes: 0 additions & 2 deletions docker/cron/crontab

This file was deleted.

12 changes: 0 additions & 12 deletions docker/cron/docker-entrypoint.sh

This file was deleted.

Loading
Loading