IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Docker Discussion :

[Docker] projet Symfony


Sujet :

Docker

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2010
    Messages
    228
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2010
    Messages : 228
    Par défaut [Docker] projet Symfony
    Bonjour à tous,

    je m'interroge sur les bonnes pratiques concernant l'architecture devops de mon projet symfony.

    j'ai un projet symfony et dans ce projet , j'ai un dossier .docker qui contient plusieurs choses.

    voici l'architecture du dossier .docker

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    .
    .
    ├── .env
    ├── .env.example
    ├── docker-compose-dev.yml
    ├── docker-compose-prod.yml
    ├── mariadb
    │** └── Dockerfile
    ├── nginx
    │** ├── Dockerfile
    │** ├── Dockerfile_ci
    │** ├── dev
    │** │** └── default.conf
    │** └── prod
    │**     └── default.conf
    └── php
        ├── Dockerfile
        ├── dev
        │** └── php.ini
        ├── entrypoint.prod.sh
        ├── entrypoint.sh
        └── prod
            └── php.ini

    Voici mon docker-compose de production qui est build dans ma CI


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    services:
      db:
        build:
          context: mariadb
        image: registry.mydomain.com/projet/db:latest
        restart: always
        volumes:
          - datadb:/var/lib/mysql
        ports:
          - "3306:3306"
        environment:
          MARIADB_USER: ${MYSQL_USER}
          MARIADB_PASSWORD: ${MYSQL_PASSWORD}
          MARIADB_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
          MARIADB_DATABASE: ${MYSQL_DATABASE}
        networks:
          - shared_corporate
      nginx:
        build:
          context: ..
          dockerfile: .docker/nginx/Dockerfile_ci
          args:
            MODE: ${MODE:-prod}
        image: registry.mydomain.com/projet/nginx:latest
        restart: always
        ports:
          - 80:80
        depends_on:
          - phpfpm
          - db
        networks:
          - shared_corporate
      phpfpm:
        build:
          context: ..
          dockerfile: .docker/php/Dockerfile
          args:
            TIMEZONE: ${TIMEZONE}
            MODE: ${MODE:-prod}
        container_name: php_entreprise
        image: registry.mydomain.com/projet/php:latest
        restart: always
        networks:
          - shared_corporate
        environment:
          APP_ENV: prod
    volumes:
      apache_log:
      datadb:
    
    
    networks:
      shared_corporate:
        name: shared_corporate

    mon dockerfile pour php FPM

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    FROM php:8.4.10-fpm-bookworm
    
    ARG TIMEZONE
    ARG MODE
    
    COPY .docker/php/${MODE}/php.ini /usr/local/etc/php/conf.d/docker-php-config.ini
    
    RUN apt-get update && apt-get install -y \
        gnupg \
        g++ \
        procps \
        openssl \
        git \
        unzip \
        zlib1g-dev \
        libzip-dev \
        libfreetype6-dev \
        libpng-dev \
        libjpeg-dev \
        libicu-dev  \
        libonig-dev \
        libxslt1-dev \
        libpq-dev \
        acl \
        && echo 'alias sf="php bin/console"' >> ~/.bashrc
    
    RUN docker-php-ext-configure intl
    
    #RUN docker-php-ext-configure gd --with-jpeg --with-freetype
    
    #RUN docker-php-ext-install \
    #    pdo pdo_mysql zip xsl gd intl opcache exif mbstring intl
    
    RUN docker-php-ext-install \
        pdo pdo_mysql zip xsl intl opcache exif mbstring intl
    
    
    RUN pecl install apcu && docker-php-ext-enable apcu
    RUN pecl install redis && docker-php-ext-enable redis
    
    # Set timezone
    RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && echo ${TIMEZONE} > /etc/timezone \
        && printf '[PHP]\ndate.timezone = "%s"\n', ${TIMEZONE} > /usr/local/etc/php/conf.d/tzone.ini \
        && "date"
    
    RUN printf '[intl]\nintl.default_locale = fr\n' > /usr/local/etc/php/conf.d/intl.ini
    
    RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    
    
    COPY . /tmp/symfony
    RUN ls -la /tmp/symfony
    
    RUN if [ "$MODE" = "prod" ]; then \
        mkdir -p /var/www/symfony && \
        cp -ar /tmp/symfony/. /var/www/symfony && \
        chown -R www-data:www-data /var/www/symfony; \
    fi
    
    WORKDIR /var/www/symfony
    
    COPY .docker/php/entrypoint.sh /usr/local/bin/entrypoint.sh
    COPY .docker/php/entrypoint.prod.sh /usr/local/bin/entrypoint.prod.sh
    RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/entrypoint.prod.sh
    
    ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
    et voici mon nginx : qui est plutot très simple

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    FROM nginx:latest AS base
    EXPOSE 80
    Selon vous, que-ce qui doit être modifier pour respecter les bonnes pratiques ?

  2. #2
    Expert confirmé
    Avatar de mathieu
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    10 699
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 10 699
    Par défaut
    est ce qu'il y a un point particulier qui vous dérange dans votre façon de travailler sur ce projet ?
    souvent, c'est quand on répète régulièrement quelque chose qu'on sent que ça peut être amélioré et automatisé.

Discussions similaires

  1. Réponses: 8
    Dernier message: 11/06/2010, 15h09
  2. [1.x] Encodage de projet Symfony avec IonCube
    Par Invité dans le forum Symfony
    Réponses: 3
    Dernier message: 16/02/2010, 15h40
  3. [1.x] Déplacer projet symfony entier sur une autre machine
    Par mixka13 dans le forum Symfony
    Réponses: 4
    Dernier message: 30/12/2009, 16h02
  4. Réponses: 0
    Dernier message: 22/03/2009, 00h32
  5. [1.x] Déployer un projet symfony sur un serveur
    Par phoelis1 dans le forum Symfony
    Réponses: 10
    Dernier message: 27/05/2008, 18h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo