Skip to content

Instantly share code, notes, and snippets.

@piotrkochan
Last active August 21, 2019 19:37
Show Gist options
  • Save piotrkochan/cd0dc28f7223ede441c403423e57875e to your computer and use it in GitHub Desktop.
Save piotrkochan/cd0dc28f7223ede441c403423e57875e to your computer and use it in GitHub Desktop.
Simple Makefile which builds Symfony 4 App and make it easier to deploy via FTP or similar method.
DIST = dist
clean:
rm -rf $(DIST)/
mkdir $(DIST)/
copy:
cp -r assets bin config src templates tests translations $(DIST)/
cp composer.json composer.lock package.json symfony.lock yarn.lock $(DIST)/
cp webpack.config.js $(DIST)/
mkdir $(DIST)/var
mkdir $(DIST)/public
cp public/.htaccess public/index.php $(DIST)/public/
cp -r public/images $(DIST)/public/
rm -rf $(DIST)/public/uploads
composer:
# .env.prod is something what could be done better here
cp .env .env.prod $(DIST)/
APP_ENV=prod composer install -d $(DIST)/ --no-dev --optimize-autoloader --no-scripts
cd $(DIST); php bin/console --env=prod assets:install
frontend:
cd $(DIST); yarn
cd $(DIST); yarn build
rm -rf $(DIST)/node_modules
zip:
zip -r build.zip $(DIST)/* && rm -rf $(DIST)/* && mv build.zip $(DIST)
build: clean copy composer frontend zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment