Skip to content

Commit

Permalink
Merge pull request #30 from smartbooster/6_symfony_docker_lock
Browse files Browse the repository at this point in the history
Solve #6 with symfony-docker.lock + #15 to auto install smartbooster bundles
  • Loading branch information
mathieu-ducrot committed Jan 4, 2024
2 parents 0af135f + a0303d4 commit 1ce1b08
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

###> smartbooster/standard-bundle ###
/.phpcs-cache
###< smartbooster/standard-bundle ###
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ make df
```

Relaunch the stack (`make up` + `make install` on another terminal if some changes are made on the Dockerfile or make/install.mk files).
Check the diffs and commit any changes that feels relevant to you.

> A symfony-docker.lock while be generated each time you run the docker-fetch.
> This file helps you to keep track of which version of the docker stack you are currently using.
> It should be committed on your project.
Finally, check the diffs and commit any changes that feels relevant to you.

## Working on the symfony-docker stack

Expand Down
11 changes: 0 additions & 11 deletions make/dev.mk

This file was deleted.

7 changes: 7 additions & 0 deletions make/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ docker-fetch: ## Fetch smartbooster/symfony-docker stack files
git remote add docker git@github.com:smartbooster/symfony-docker.git
git fetch docker
git checkout docker/main .
rm -f symfony-docker.lock
touch symfony-docker.lock
echo '{' >> symfony-docker.lock
echo ' "hash": "'$(shell git rev-parse docker/main)'", ' >> symfony-docker.lock
echo ' "fetch_time": "'$(shell date +%Y-%m-%dT%H:%M:%S)'",' >> symfony-docker.lock
echo ' "tag": "'$(shell git rev-parse docker/main | git tag --contains)'"' >> symfony-docker.lock
echo '}' >> symfony-docker.lock
git remote remove docker
make docker-post-fetch
df: docker-fetch ## Alias for docker-fetch
Expand Down
24 changes: 21 additions & 3 deletions make/install.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,31 @@ install-symfony: ## Install a new fresh version of symfony
sed '3,4c\ url: "%env(resolve:MYSQL_ADDON_URI)%"\n server_version: "%env(resolve:MYSQL_ADDON_VERSION)%"' -i config/packages/doctrine.yaml
sed '5,8d' -i config/packages/doctrine.yaml
rm config/packages/messenger.yaml
docker compose exec --user=dev php composer remove symfony/doctrine-messenger
rm phpunit.xml.dist
docker compose exec --user=dev php composer remove symfony/doctrine-messenger symfony/asset-mapper
docker compose exec --user=dev php composer remove --dev phpunit/phpunit
rm -r assets
# Add SmartBooster bundles
docker compose exec --user=dev php composer config --json extra.symfony.endpoint '["https://api.github.com/repos/smartbooster/standard-bundle/contents/recipes.json", "flex://defaults"]'
docker compose exec --user=dev php composer require --dev --no-interaction smartbooster/standard-bundle
docker compose exec --user=dev php composer require --no-interaction smartbooster/core-bundle
git restore package.json
# Run Tests and database status to check that everything works fine
docker compose exec --user=dev php make phpunit
docker compose exec --user=dev php make orm-status
echo Install complete!

.PHONY: remove-symfony
remove-symfony: ## Remove all symfony related files of the repository
sudo rm -rf bin config migrations node_modules public project src templates tests translations vendor ./var/cache ./var/log/php/* composer.json composer.lock phpunit.xml.dist symfony.lock
sudo rm -rf bin config migrations node_modules public project src templates tests translations vendor ./var/cache ./var/log/php/* \
make/dev.mk \
make/qualimetry.mk \
make/test.mk \
composer.json \
composer.lock \
phpcs.xml \
phpstan.neon \
phpunit.xml.dist \
symfony.lock

.PHONY: install
install: ## Install the project. MUST BY RUN OUTSIDE OF THE DOCKER CONTAINER !
Expand Down

0 comments on commit 1ce1b08

Please sign in to comment.