Skip to content

This is the easiest PHP Symfony Framework setup for Docker to run. It uses the Symfony CLI tool and should only be used for development environment only.

License

Notifications You must be signed in to change notification settings

KingDestinyThe1st/Symfony-Framework-Setup-for-Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Symfony Basic Docker Setup

This repository provides the simplest and most efficient Docker setup for running Symfony applications. It includes a Dockerfile for building the container and a Docker Compose file for easy management.

YOU WILL NOT FIND ANY DOCKER SETUP FOR PHP SYMFONY FRAMEWORK AS SIMPLE AND EASY TO USE AS THIS

Author: Destiny Diekedie Contact: Upwork LinkedIn

Features

  • Ubuntu 20.04 base image: Provides a stable and reliable environment.
  • PHP 8.2: Uses the latest stable PHP version for optimal performance and features.
  • Node.js 18.18.2 and npm: Includes Node.js and npm for frontend development.
  • Composer: Installs Composer for dependency management.
  • Symfony CLI: Installs the Symfony CLI for development tools.
  • Graceful shutdown: The entrypoint.sh script ensures the Symfony server stops cleanly when the container is stopped.
  • Port 8001: The Symfony server runs on port 8001, making it easy to access.
  • Volume mapping: Maps your local app/ directory to /var/www/html/ in the container, allowing for seamless code changes.
  • Docker Compose: Simplifies the process of building and running the container.
  • Timezone Set: Sets the timezone to Africa/Lagos.

Prerequisites

  • Docker installed on your system.
  • Docker Compose installed on your system.

Getting Started

  1. Clone the repository:

    git clone <your-repository-url>
    cd <repository-directory>
  2. Create your Symfony project directory:

    Create an app directory in the root of your project. This directory will be mounted into the Docker container.

    mkdir app
  3. Place your Symfony project inside the app directory or Leave the app directory empty: You can leave the app directory empty or place your existing Symfony project inside the newly created app directory. In case you left the app directory empty, make sure to restart the container or symfony server after installing a new Symfony project. The Symfony CLI tool will not restart the server for you.

  4. Build and run the Docker container:

    docker-compose up --build

    This command will build the Docker image and start the container.

  5. Access your Symfony application:

    Open your web browser and navigate to http://localhost:8001.

  6. Stop the container:

    docker-compose down

Directory Structure