Creating a New TYPO3 Project (TYPO3 13.4 with Docker Compose)

This guide walks you through setting up a new TYPO3 13.4 project using:

  • Git
  • Docker (with Docker Compose v2)
  • Composer
  • TYPO3 13.4
  • GitLab automatic deployment

1. Git

Clone the existing project repository from GitLab:

git clone git@gitlab.ext.dev:ext.dev/[project_name]

Replace [project_name] with your actual project name. This creates a local folder with the latest code from the repository.


2. Docker

Configure Docker

Use the following file structure and configuration:

{project_name}
├── docker-compose.yml
└── docker/
    └── typo3/
        └── Dockerfile

These files can usually be copied from another project without changes.

docker-compose.yml

services:
  typo3:
    build:
      context: ./docker/typo3
    ports:
      - "80:80"
    volumes:
      - .:/var/www/html:Z
    environment:
      TYPO3_CONTEXT: Development
      HOSTNAME: localhost
      APACHE_DOCUMENT_ROOT: /var/www/html/public
    links:
      - database
    networks:
      - backend

  database:
    image: mysql:8.0
    command:
      - --character-set-server=utf8
      - --collation-server=utf8_unicode_ci
      - --default-authentication-plugin=mysql_native_password
    volumes:
      - ./data/mysql:/var/lib/mysql
      - ./config/mysql:/etc/mysql/conf.d
    environment:
      MYSQL_USER: typo3
      MYSQL_PASSWORD: typo3
      MYSQL_DATABASE: typo3
      MYSQL_ROOT_PASSWORD: rootpassword
    networks:
      - backend

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    links:
      - database:db
    ports:
      - "8080:80"
    networks:
      - backend

networks:
  backend:

docker/typo3/Dockerfile

FROM php:8.4-apache
LABEL maintainer="ext.dev <info@ext.dev>"

ENV APACHE_DOCUMENT_ROOT=/var/www/html/public

RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \
    sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        wget \
        libxml2-dev libfreetype6-dev libjpeg-dev libpng-dev \
        zlib1g-dev libzip-dev unzip \
        imagemagick && \
    docker-php-ext-configure gd --with-freetype --with-jpeg && \
    docker-php-ext-install -j$(nproc) mysqli soap gd zip opcache intl xml && \
    echo 'max_execution_time = 240\nmax_input_vars = 1500\nupload_max_filesize = 32M\npost_max_size = 32M\nmemory_limit = 512M' > /usr/local/etc/php/conf.d/typo3.ini && \
    a2enmod rewrite deflate && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /usr/src/*

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

Start Docker

docker compose up --build -d

Access:

  • TYPO3: http://localhost/
  • phpMyAdmin: http://localhost:8080/

3. Composer

Create Composer Files

Create a composer.json file in the project root:

{
  "require": {
    "typo3/minimal": "^13.4",
    "typo3/cms-about": "^13.4",
    "typo3/cms-belog": "^13.4",
    "typo3/cms-beuser": "^13.4",
    "typo3/cms-fluid-styled-content": "^13.4",
    "typo3/cms-reports": "^13.4",
    "typo3/cms-rte-ckeditor": "^13.4",
    "typo3/cms-tstemplate": "^13.4",
    "typo3/cms-form": "^13.4",
    "typo3/cms-lowlevel": "^13.4",
    "typo3/cms-seo": "^13.4"
  },
  "repositories": [
    {
      "type": "path",
      "url": "./packages/*"
    }
  ],
  "config": {
    "allow-plugins": {
      "typo3/class-alias-loader": true,
      "typo3/cms-composer-installers": true
    }
  }
}

Local Extensions

Project-specific extensions go into:

packages/
  └── extension_key/
        ├── composer.json
        └── ...

Example composer.json for extension:

{
  "name": "extdev/extension_key",
  "type": "typo3-cms-extension",
  "description": "Extension Description",
  "license": "Unlicense",
  "version": "13.4.0",
  "require": {
    "typo3/cms-core": "^13.4"
  },
  "extra": {
    "typo3/cms": {
      "extension-key": "extension_key"
    }
  },
  "replace": {
    "extension_key": "self.version"
  },
  "autoload": {
    "psr-4": {
      "ExtDev\\ExtensionNamespace\\": "Classes"
    }
  }
}

Add it to the root composer.json:

"require": {
  "extdev/extension_key": "@dev"
}

Install with Composer

docker compose exec typo3 composer install

Adjust File Permissions

sudo chown user:user -R .

Ignore file mode changes in Git:

git config core.fileMode false

4. TYPO3 Installation

Access the TYPO3 install tool at:

http://localhost/typo3/

If it doesn’t open, try:

sudo chmod -R 777 [project_name]/

Database Setup

  • Type: mysql
  • Server: database
  • Database: typo3
  • User: typo3
  • Password: typo3

Admin User

Create an admin account.

Site Name

Use the project name as the site name.


5. Start Development

You can now begin development by implementing your sitepackage extension and building your TYPO3 project.