Skip to content
/ symfony-docker Public template

Symfony 6 setup with Docker and Traefik

License

Notifications You must be signed in to change notification settings

ToshY/symfony-docker

Repository files navigation

🎼 Symfony Docker 🐋

Code style Mess detector Static analysis Unit tests Security

A webapp starting template for Symfony 6 with Docker Compose.

📜 Introduction

This repository acts as a template to set up basic Symfony webapp with docker compose and Traefik.

Prerequisites

Note: You can switch out Traefik for any other reverse proxy of your choice (or not use a reverse proxy at all), but this would require additional tweaking of labels (or exposing ports) in the docker compose configuration.

🎬 Get Started

Update hosts file

Add webapp.local to your hosts files, e.g. /etc/hosts (Unix).

Initialise dotenv

For first time setup, initialise the .env.local from the .env.

task init

You can now tweak the values in the .env.local if needed.

Start application services

task up

Visit the application

If the reverse proxy is configured correctly, you should be able to visit webapp.local in your browser and be greeted by Symfony's default landing page.

Note: You can disregard the SSL certificate warnings for development usages.

🛠️ Contribute

Install dependencies

task app:install:dev

Enable GrumPHP

task grum:init

Manual test run

task contribute

🧰 DIY

If you want to create a Symfony project from scratch yourself, with the essential dependencies, you can do the following:

# Substitute "dev.example.com" with desired project directory name
docker run --rm -it -v $(pwd):/app composer:2 create-project symfony/skeleton:6.4.* dev.example.com
docker run --rm -it -v $(pwd)/dev.example.com:/app composer:2 require webapp -n
sudo chown -R $(id -u):$(id -g) $(pwd)/dev.example.com

This will give you a basic Symfony webapp environment (without Docker).

❕ Licence

This repository comes with a MIT license.