Jump to content

Migrating a PHP project to a Dockers environment and preserving git history


Recommended Posts

I have the following PHP project, and I DO care about keeping the git history:

michael@ubuntu-hp-laptop-original:/var/www/facdocs/api$ ls -la
total 1076
drwxr-xr-x 18 michael michael   4096 Feb 11 07:52 .
drwxr-xr-x 37 michael michael   4096 Feb 22 18:42 ..
drwxrwxr-x  2 michael michael   4096 Sep 16 05:34 bin
-rw-rw-r--  1 michael michael   3814 Feb 15 05:38 composer.json
-rw-rw-r--  1 michael michael 477849 Feb 15 05:38 composer.lock
-rw-rw-r--  1 michael michael 470716 Sep 16 05:25 composer.lock2.tmp
drwxr-xr-x  5 michael michael   4096 Feb 22 09:48 config
lrwxrwxrwx  1 michael michael      7 Oct 20 04:53 core -> ../core
-rw-rw-r--  1 michael michael   2026 Feb 22 09:40 .env
-rw-rw-r--  1 michael michael    320 Nov 22 06:23 .env.test
drwxrwxr-x  2 michael michael   4096 Dec 11 10:29 fixtures
drwxrwxr-x  8 michael michael   4096 Feb 22 16:17 .git
-rw-rw-r--  1 michael michael    704 Dec 11 10:29 .gitignore
drwxr-xr-x  2 michael michael   4096 Oct 30 15:23 index
drwxrwxr-x  2 michael michael   4096 Feb  3 07:01 migrations
lrwxrwxrwx  1 michael michael      8 Aug  6  2022 notes -> ../notes
-rw-rw-r--  1 michael michael    197 Sep 16 05:33 .php-cs-fixer.dist.php
-rw-rw-r--  1 michael michael  30546 Feb  3 16:59 .phpunit.result.cache
-rw-rw-r--  1 michael michael   1431 Dec 13 04:14 phpunit.xml.dist
drwxrwxr-x  4 michael michael   4096 Feb 22 09:29 public
-rw-rw-r--  1 michael michael   2689 Jul 17  2022 rector.php
drwxr-xr-x  3 michael michael   4096 Jul 12  2022 resources
drwxr-xr-x  2 michael michael   4096 Oct 10 05:33 source-data
drwxrwxr-x 30 michael michael   4096 Nov  9 07:53 src
-rw-rw-r--  1 michael michael  10924 Dec 11 10:29 symfony.lock
drwxrwxr-x  2 michael michael   4096 Jun 18  2022 templates
drwxrwxr-x  5 michael michael   4096 Feb 15 05:35 testing
drwxrwxr-x  2 michael michael   4096 Feb  2 05:50 tests
-rw-r--r--  1 michael michael   1415 Jan 21 11:00 TODO.md
drwxrwxr-x  2 michael michael   4096 Sep 16 05:33 translations
drwxrwxrwx  6 facdocs michael   4096 Jun 19  2022 var
drwxrwxr-x 49 michael michael   4096 Feb 15 05:38 vendor
michael@ubuntu-hp-laptop-original:/var/www/facdocs/api$


I have another project which uses dockers and PHP as well as other stuff, and I don't care about keeping the git history:

michael@apiplatform-HP-EliteBook-830-G6:~/demo$ ls -la
total 64
drwxrwxr-x  7 michael michael 4096 Feb 17 08:35 .
drwxr-x--- 26 michael michael 4096 Feb 22 19:08 ..
drwxrwxr-x 13 michael michael 4096 Feb 17 09:48 api
-rw-rw-r--  1 michael michael 1859 Feb 17 08:35 docker-compose.override.yml
-rw-rw-r--  1 michael michael  396 Feb 17 08:35 docker-compose.prod.yml
-rw-rw-r--  1 michael michael 3796 Feb 17 08:35 docker-compose.yml
-rw-rw-r--  1 michael michael 1203 Feb 17 08:35 .editorconfig
drwxrwxr-x  8 michael michael 4096 Feb 22 19:08 .git
-rw-rw-r--  1 michael michael  319 Feb 17 08:35 .gitattributes
drwxrwxr-x  3 michael michael 4096 Feb 17 08:35 .github
-rw-rw-r--  1 michael michael   72 Feb 17 08:35 .gitignore
drwxrwxr-x  3 michael michael 4096 Feb 17 08:35 helm
-rw-rw-r--  1 michael michael 1066 Feb 17 08:35 LICENSE
drwxrwxr-x 12 michael michael 4096 Feb 22 19:06 pwa
-rwxrwxr-x  1 michael michael 2739 Feb 17 08:35 README.md
-rwxrwxr-x  1 michael michael  433 Feb 17 08:35 update-deps.sh

michael@apiplatform-HP-EliteBook-830-G6:~/demo$ cd api

michael@apiplatform-HP-EliteBook-830-G6:~/demo/api$ ls -la
total 520
drwxrwxr-x 13 michael michael   4096 Feb 17 09:48 .
drwxrwxr-x  7 michael michael   4096 Feb 17 08:35 ..
drwxrwxr-x  2 michael michael   4096 Feb 17 08:35 bin
-rw-rw-r--  1 michael michael   3330 Feb 22 19:06 composer.json
-rw-rw-r--  1 michael michael 419938 Feb 22 19:05 composer.lock
drwxrwxr-x  5 michael michael   4096 Feb 17 08:35 config
drwxrwxr-x  4 michael michael   4096 Feb 17 08:35 docker
-rw-rw-r--  1 michael michael   3977 Feb 17 08:35 Dockerfile
-rw-rw-r--  1 michael michael    390 Feb 17 08:35 .dockerignore
-rw-rw-r--  1 michael michael   2811 Feb 17 09:48 .env
-rw-rw-r--  1 michael michael    215 Feb 17 09:48 .env.test
drwxrwxr-x  2 michael michael   4096 Feb 17 08:35 fixtures
-rw-rw-r--  1 michael michael    517 Feb 17 09:04 .gitignore
drwxrwxr-x  2 michael michael   4096 Feb 17 08:35 migrations
-rw-rw-r--  1 michael michael    197 Feb 17 08:35 .php-cs-fixer.dist.php
-rw-rw-r--  1 michael michael   1367 Feb 17 09:48 phpunit.xml.dist
-rw-rw-r--  1 michael michael    444 Feb 17 08:35 psalm.xml.dist
drwxrwxr-x  3 michael michael   4096 Feb 17 08:35 public
drwxrwxr-x 10 michael michael   4096 Feb 17 09:04 src
-rw-rw-r--  1 michael michael  16462 Feb 17 09:48 symfony.lock
drwxrwxr-x  2 michael michael   4096 Feb 17 08:35 templates
drwxrwxr-x  5 michael michael   4096 Feb 17 09:48 tests
drwxr-xr-x  2 root    root      4096 Feb 17 08:35 var
drwxr-xr-x 42 root    root      4096 Feb 22 19:05 vendor
michael@apiplatform-HP-EliteBook-830-G6:~/demo/api$


I wish to replace the content in the api folder of the second project with the content in the first one, and either:

  1. Keep the second project's git history and make the api folder a git submodule.
  2. Get rid of the second project's git history mov api/.git to . so I all the second project's files appear as new in the git history and I have only one git repo.

I thought this would be more straight forward, but repeatedly get PHP composer errors about classes not being found.  I think it has to do with how some of the folders are mounted, but not positive.  Note that I didn't just replace the content in the api folder, but actually replaced the folder, and maybe that is breaking things?  And along those lines, maybe not replace app/var and app/vendor either?

Thank much

1 hour ago, NotionCommotion said:

but repeatedly get PHP composer errors about classes not being found.

Whose classes? Are there maybe autoload paths that need to be regenerated?

8 hours ago, requinix said:

Whose classes? Are there maybe autoload paths that need to be regenerated?

Vendor classes.  Maybe regenerated.   How does one regenerate within a docker?

 

1 hour ago, maxxd said:

What's your docker-compose file look like? We need to see that in order to say if it's an issue with the volume mounts.

docker-compose.yml

version: "3.4"

services:
  php:
    build:
      context: ./api
      target: app_php
    depends_on:
      - database
    restart: unless-stopped
    volumes:
      - php_socket:/var/run/php
    healthcheck:
      interval: 10s
      timeout: 3s
      retries: 3
      start_period: 30s
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-14}
      TRUSTED_PROXIES: ${TRUSTED_PROXIES:-127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16}
      TRUSTED_HOSTS: ^${SERVER_NAME:-example\.com|localhost}|caddy$$
      MERCURE_URL: ${CADDY_MERCURE_URL:-http://caddy/.well-known/mercure}
      MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure
      MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}

  consumer:
    build:
      context: ./api
      target: app_php
    entrypoint: docker-php-entrypoint
    command: bin/console messenger:consume
    depends_on:
      - database
    restart: unless-stopped
    healthcheck:
      test: ['CMD', 'ps', 'aux', '|', 'egrep', '"\d+:\d+ php bin/console messenger:consume"']
      interval: 10s
      timeout: 3s
      retries: 3
      start_period: 30s
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-14}
      TRUSTED_PROXIES: ${TRUSTED_PROXIES:-127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16}
      TRUSTED_HOSTS: ^${SERVER_NAME:-example\.com|localhost}|caddy$$
      MERCURE_URL: ${CADDY_MERCURE_URL:-http://caddy/.well-known/mercure}
      MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure
      MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}

  pwa:
    build:
      context: ./pwa
      target: prod
    environment:
      NEXT_PUBLIC_ENTRYPOINT: http://caddy

  caddy:
    build:
      context: api/
      target: app_caddy
    depends_on:
      - php
      - pwa
    environment:
      PWA_UPSTREAM: pwa:3000
      SERVER_NAME: ${SERVER_NAME:-localhost}, caddy:80
      MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
      MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
      MERCURE_EXTRA_DIRECTIVES: demo
    restart: unless-stopped
    volumes:
      - php_socket:/var/run/php
      - caddy_data:/data
      - caddy_config:/config
    ports:
      # HTTP
      - target: 80
        published: ${HTTP_PORT:-80}
        protocol: tcp
      # HTTPS
      - target: 443
        published: ${HTTPS_PORT:-443}
        protocol: tcp
      # HTTP/3
      - target: 443
        published: ${HTTP3_PORT:-443}
        protocol: udp

###> doctrine/doctrine-bundle ###
  database:
    image: postgres:${POSTGRES_VERSION:-14}-alpine
    environment:
      - POSTGRES_DB=${POSTGRES_DB:-app}
      # You should definitely change the password in production
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-!ChangeMe!}
      - POSTGRES_USER=${POSTGRES_USER:-app}
    volumes:
      - db_data:/var/lib/postgresql/data
      # you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./api/docker/db/data:/var/lib/postgresql/data
###< doctrine/doctrine-bundle ###

# Mercure is installed as a Caddy module, prevent the Flex recipe from installing another service
###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###

volumes:
  php_socket:
  caddy_data:
  caddy_config:
###> doctrine/doctrine-bundle ###
  db_data:
###< doctrine/doctrine-bundle ###
###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###


api/Dockerfile

#syntax=docker/dockerfile:1.4
# Adapted from https://github.com/dunglas/symfony-docker

# Prod image
FROM php:8.1-fpm-alpine AS app_php

ENV APP_ENV=prod

WORKDIR /srv/app

# persistent / runtime deps
RUN apk add --no-cache \
        acl \
        fcgi \
        file \
        gettext \
        git \
        gnu-libiconv \
    ;

# install gnu-libiconv and set LD_PRELOAD env to make iconv work fully on Alpine image.
# see https://github.com/docker-library/php/issues/240#issuecomment-763112749
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so

RUN set -eux; \
    apk update; \
    apk upgrade -U -a --purge; \
    apk add --no-cache --virtual .build-deps \
        $PHPIZE_DEPS \
        icu-data-full \
        icu-dev \
        libzip-dev \
        zlib-dev \
    ; \
    \
    docker-php-ext-configure zip; \
    docker-php-ext-install -j$(nproc) \
        intl \
        zip \
    ; \
    pecl install \
        apcu \
    ; \
    pecl clear-cache; \
    docker-php-ext-enable \
        apcu \
        opcache \
    ; \
    \
    runDeps="$( \
        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
            | tr ',' '\n' \
            | sort -u \
            | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
    )"; \
    apk add --no-cache --virtual .app-phpexts-rundeps $runDeps; \
    \
    apk del .build-deps

###> recipes ###
###> doctrine/doctrine-bundle ###
RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \
    docker-php-ext-install -j$(nproc) pdo_pgsql; \
    apk add --no-cache --virtual .pgsql-rundeps so:libpq.so.5; \
    apk del .pgsql-deps
###< doctrine/doctrine-bundle ###
###< recipes ###

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY --link docker/php/conf.d/app.ini $PHP_INI_DIR/conf.d/
COPY --link docker/php/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/

COPY --link docker/php/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf
RUN mkdir -p /var/run/php

COPY --link docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN chmod +x /usr/local/bin/docker-healthcheck

HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"]

COPY --link docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint

ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin"

COPY --from=composer:2 --link /usr/bin/composer /usr/bin/composer

# prevent the reinstallation of vendors at every changes in the source code
COPY composer.* symfony.* ./
RUN set -eux; \
    composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress; \
    composer clear-cache

# copy sources
COPY --link . .
RUN rm -Rf docker/

RUN set -eux; \
    mkdir -p var/cache var/log; \
    composer dump-autoload --classmap-authoritative --no-dev; \
    composer dump-env prod; \
    composer run-script --no-dev post-install-cmd; \
    chmod +x bin/console; sync
VOLUME /srv/app/config/jwt/

# Dev image
FROM app_php AS app_php_dev

ENV APP_ENV=dev XDEBUG_MODE=off
VOLUME /srv/app/var/

RUN rm $PHP_INI_DIR/conf.d/app.prod.ini; \
    mv "$PHP_INI_DIR/php.ini" "$PHP_INI_DIR/php.ini-production"; \
    mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"

COPY --link docker/php/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/

RUN set -eux; \
    apk add --no-cache --update --virtual .build-deps linux-headers $PHPIZE_DEPS; \
    pecl install xdebug; \
    docker-php-ext-enable xdebug; \
    apk del .build-deps

RUN rm -f .env.local.php

# Build Caddy with the Mercure and Vulcain modules
FROM caddy:2-builder-alpine AS app_caddy_builder

RUN xcaddy build \
    --with github.com/dunglas/mercure \
    --with github.com/dunglas/mercure/caddy \
    --with github.com/dunglas/vulcain \
    --with github.com/dunglas/vulcain/caddy

# Caddy image
FROM caddy:2-alpine AS app_caddy

WORKDIR /srv/app

COPY --from=app_caddy_builder --link /usr/bin/caddy /usr/bin/caddy
COPY --from=app_php --link /srv/app/public public/
COPY --link docker/caddy/Caddyfile /etc/caddy/Caddyfile


 

I ended up leaving the folder which are mounted to allow external editing alone and just updated the other files.  At first, all seemed good, but then something went wrong.

I start the docker using docker compose up, and then I instantly start getting errors like the following.  So, I expect that maybe autoload paths need to be regenerated or I have a issue with my composer.json file.  Problem is I can update composer as the docker keeps on restarting, and am having a difficult time troubleshooting.  I suspect that the docker-compose (and not the DockerFile, right?) file is initiating running some pre-check script and hoping I can temporarily bypass it, but it what initiates it escapes me.  Any thoughts?  Thank you

Cannot autowire service "App\Command\AddSystemUser": argument "$phoneNumberUtil" of method "App\Command\AbstractAddUser::__construct()" references class "libphonenumber\PhoneNumberUtil" but no such service exists.

PS.  In addition to docker-compose.yml provided above, I also have docker-compose.override.yml.

 

version: "3.4"

# Development environment override
services:
  php:
    build:
      target: app_php_dev
    volumes:
      - ./api:/srv/app
      - ./api/docker/php/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro
      # If you develop on Mac or Windows you can remove the vendor/ directory
      #  from the bind-mount for better performance by enabling the next line:
      #- /srv/app/vendor
    environment:
      # See https://xdebug.org/docs/all_settings#mode
      XDEBUG_MODE: "${XDEBUG_MODE:-off}"
    extra_hosts:
      # Ensure that host.docker.internal is correctly defined on Linux
      - host.docker.internal:host-gateway

  consumer:
    build:
      target: app_php_dev
    volumes:
      - ./api:/srv/app
      - ./api/docker/php/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro
      # If you develop on Mac or Windows you can remove the vendor/ directory
      #  from the bind-mount for better performance by enabling the next line:
      #- /srv/app/vendor
    environment:
      # See https://xdebug.org/docs/all_settings#mode
      XDEBUG_MODE: "${XDEBUG_MODE:-off}"
    extra_hosts:
      # Ensure that host.docker.internal is correctly defined on Linux
      - host.docker.internal:host-gateway

  pwa:
    build:
      context: ./pwa
      target: dev
    volumes:
      - ./pwa:/srv/app
    environment:
      API_PLATFORM_CREATE_CLIENT_ENTRYPOINT: http://caddy
      API_PLATFORM_CREATE_CLIENT_OUTPUT: .

  caddy:
    volumes:
      - ./api/public:/srv/app/public:ro
      - ./api/docker/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
    environment:
      MERCURE_EXTRA_DIRECTIVES: demo

###> doctrine/doctrine-bundle ###
  database:
    ports:
      - target: 5432
        published: 5432
        protocol: tcp
###< doctrine/doctrine-bundle ###

###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###

 

I assume given the target attribute that you're deploying to production with this, yeah? If so I'm gonna bow out (hopefully) gracefully - I don't have enough experience with servers to guarantee the production-readiness of my base docker build. If you're just using it for dev, feel free to hit me up and I'll share - admittedly it's set up for my current Laravel environments, but it could be a useful jumping-off point.

Thanks maxxd!  Not quite production or even close, unfortunately...  Current objective is to provide a workableness system to get frontend peps to better understand what they need to do on their end.  I probably shouldn't be going down this dockers path as it seems like a blackhole to me, but the main reasons I am doing so is it allows me to better show the frontend people what they need to interface to by "automatically" creating a super-basic client app.  I somewhat got things working, but then restarted the docker, and had SQL problems...   I know it can't be magic, but not being able to identify what is initiating the script which is causing me grief makes me kind of hate dockers.  I've made some progress and see that it is calling a PHP script to initiate things, but even after I comment out what I think are the culprits, still issues...  Will try again tomorrow!

I mostly figured out the SQL error.   Appears this was being called by Dockerfile which added a table called user which I had been using, and I didn't realize it was called when the image was being created.  Maybe got some technicalities wrong, but changing it got rid of the SQL errors.

# api/docker/php/docker-entrypoint.sh
#!/bin/sh
        # bla bla bla...
		if [ "$( find ./migrations -iname '*.php' -print -quit )" ]; then
			php bin/console doctrine:migrations:migrate --no-interaction
		fi
        if [ "$APP_ENV" != 'prod' ]; then
            echo "Load fixtures"
            bin/console hautelook:fixtures:load --no-interaction
        fi
    fi
fi
exec docker-php-entrypoint "$@"

Still don't understand the composer part and the not found classes.  For instance, I see stof/doctrine-extensions-bundle (v1.7.1) first being installed, but then I get Uncaught Error: Class "Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle" not found error.  The only place I see that class being used is in bundles.php, and suppose I could comment it out like I did for libphonenumber\PhoneNumberUtil, but then suspect some other issue will pop up.  Not sure where to go next on this...  EDIT.  Maybe I got lucky!  Commented it out and at least PHP is not crashing.  Still need to better understand how all this stuff works...

 

facdocs-consumer-1 exited with code 255
facdocs-php-1       |   - Installing behat/transliterator (v1.5.0): Extracting archive
facdocs-php-1       |   - Installing brick/money (0.8.0): Extracting archive
facdocs-php-1       |   - Installing doctrine/doctrine-fixtures-bundle (3.4.2): Extracting archive
facdocs-php-1       |   - Installing fig/link-util (1.2.0): Extracting archive
facdocs-php-1       |   - Installing gesdinet/jwt-refresh-token-bundle (v1.1.1): Extracting archive
facdocs-php-1       |   - Installing giggsey/locale (2.3): Extracting archive
facdocs-php-1       |   - Installing laminas/laminas-code (4.8.0): Extracting archive
facdocs-php-1       |   - Installing symfony/translation (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing nesbot/carbon (2.66.0): Extracting archive
facdocs-php-1       |   - Installing nilportugues/sql-query-formatter (v1.2.2): Extracting archive
facdocs-php-1       |   - Installing notion-commotion/attribute-validator (1.01): Extracting archive
facdocs-php-1       |   - Installing notion-commotion/attribute-validator-command (1.06): Extracting archive
facdocs-php-1       |   - Installing symfony/intl (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing giggsey/libphonenumber-for-php (8.13.6): Extracting archive
facdocs-php-1       |   - Installing odolbeau/phone-number-bundle (v3.9.1): Extracting archive
facdocs-php-1       |   - Installing phpstan/phpdoc-parser (1.16.1): Extracting archive
facdocs-php-1       |   - Installing sebastian/version (3.0.2): Extracting archive
facdocs-php-1       |   - Installing sebastian/type (3.2.1): Extracting archive
facdocs-php-1       |   - Installing sebastian/resource-operations (3.0.3): Extracting archive
facdocs-php-1       |   - Installing sebastian/object-reflector (2.0.4): Extracting archive
facdocs-php-1       |   - Installing sebastian/object-enumerator (4.0.4): Extracting archive
facdocs-php-1       |   - Installing sebastian/global-state (5.0.5): Extracting archive
facdocs-php-1       |   - Installing sebastian/environment (5.1.5): Extracting archive
facdocs-php-1       |   - Installing sebastian/code-unit (1.0.8): Extracting archive
facdocs-php-1       |   - Installing sebastian/cli-parser (1.0.1): Extracting archive
facdocs-php-1       |   - Installing phpunit/php-timer (5.0.3): Extracting archive
facdocs-php-1       |   - Installing phpunit/php-text-template (2.0.4): Extracting archive
facdocs-php-1       |   - Installing phpunit/php-invoker (3.1.1): Extracting archive
facdocs-php-1       |   - Installing phpunit/php-file-iterator (3.0.6): Extracting archive
facdocs-php-1       |   - Installing theseer/tokenizer (1.2.1): Extracting archive
facdocs-php-1       |   - Installing sebastian/lines-of-code (1.0.3): Extracting archive
facdocs-php-1       |   - Installing sebastian/complexity (2.0.2): Extracting archive
facdocs-php-1       |   - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
facdocs-php-1       |   - Installing phpunit/php-code-coverage (9.2.24): Extracting archive
facdocs-php-1       |   - Installing phar-io/version (3.2.1): Extracting archive
facdocs-php-1       |   - Installing phar-io/manifest (2.0.3): Extracting archive
facdocs-php-1       |   - Installing phpunit/phpunit (9.6.3): Extracting archive
facdocs-php-1       |   - Installing phpstan/phpstan (1.10.2): Extracting archive
facdocs-php-1       |   - Installing rector/rector (0.15.18): Extracting archive
facdocs-php-1       |   - Installing gedmo/doctrine-extensions (v3.11.1): Extracting archive
facdocs-php-1       |   - Installing stof/doctrine-extensions-bundle (v1.7.1): Extracting archive
facdocs-php-1       |   - Installing symfony/polyfill-intl-idn (v1.27.0): Extracting archive
facdocs-php-1       |   - Installing symfony/mime (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing egulias/email-validator (4.0.1): Extracting archive
facdocs-php-1       |   - Installing symfony/mailer (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing symfony/polyfill-intl-icu (v1.27.0): Extracting archive
facdocs-php-1       |   - Installing friendsofphp/proxy-manager-lts (v1.0.14): Extracting archive
facdocs-php-1       |   - Installing symfony/proxy-manager-bridge (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing symfony/polyfill-uuid (v1.27.0): Extracting archive
facdocs-php-1       |   - Installing symfony/uid (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing symfony/templating (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing symfony/form (v6.1.11): Extracting archive
facdocs-php-1       |   - Installing moneyphp/money (v3.3.3): Extracting archive
facdocs-php-1       |   - Installing tbbc/money-bundle (5.0.1): Extracting archive
facdocs-php-1       | Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
facdocs-php-1       | Generating optimized autoload files
facdocs-consumer-1  | 2023-02-24T18:05:33+00:00 [critical] Uncaught Error: Class "Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle" not found
facdocs-consumer-1  | Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#69
facdocs-consumer-1  |   #message: """
facdocs-consumer-1  |     Attempted to load class "StofDoctrineExtensionsBundle" from namespace "Stof\DoctrineExtensionsBundle".\n
facdocs-consumer-1  |     Did you forget a "use" statement for another namespace?
facdocs-consumer-1  |     """
facdocs-consumer-1  |   #code: 0
facdocs-consumer-1  |   #file: "./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php"
facdocs-consumer-1  |   #line: 135
facdocs-consumer-1  |   trace: {
facdocs-consumer-1  |     ./vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:135 { …}
facdocs-consumer-1  |     ./vendor/symfony/http-kernel/Kernel.php:382 { …}
facdocs-consumer-1  |     ./vendor/symfony/http-kernel/Kernel.php:766 { …}
facdocs-consumer-1  |     ./vendor/symfony/http-kernel/Kernel.php:128 { …}
facdocs-consumer-1  |     ./vendor/symfony/framework-bundle/Console/Application.php:166 { …}
facdocs-consumer-1  |     ./vendor/symfony/framework-bundle/Console/Application.php:72 { …}
facdocs-consumer-1  |     ./vendor/symfony/console/Application.php:171 { …}
facdocs-consumer-1  |     ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54 { …}
facdocs-consumer-1  |     ./vendor/autoload_runtime.php:29 { …}
facdocs-consumer-1  |     ./bin/console:11 {
facdocs-consumer-1  |       ›
facdocs-consumer-1  |       › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
facdocs-consumer-1  |       ›
facdocs-consumer-1  |       arguments: {
facdocs-consumer-1  |         "/srv/app/vendor/autoload_runtime.php"
facdocs-consumer-1  |       }
facdocs-consumer-1  |     }
facdocs-consumer-1  |   }
facdocs-consumer-1  | }
facdocs-consumer-1 exited with code 255


 

Edited by NotionCommotion

If you're looking for easy onboarding and not production deployment, here's mine. I certainly won't say it's perfect, but with only a couple exceptions in the past year or so it's worked reliably for developers coming on to a project. Hope it can help some.

https://bitbucket.org/maxxdesigns/docker-base/src/main/

Thanks maxxd,  If I go through your configuration, would you be willing to answer some specific questions in order to confirm my understanding?  If so, think it is best to fully understand the Dockerfile before moving to the docker-compose.yml file, or the other way around?

Honestly, there's nothing really complex in either file - I've got a couple other, more specific setups that I use that get a bit more into the weeds (can't share those, unfortunately, but I can talk about them if there are questions). Really the dockerfile is just setting up the server instance - installing and enabling php extensions, installing node and composer, etc. The one sorta tricky thing it does is change the default webrooot in apache. And the docker-compose just creates the server and sets up the database and mail spoofer. I've found it works just about equally well on mac and windows, so it's kinda my go-to.

I'm more than happy to answer any questions on both files - either hit me up here or DM me.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.