it’s my first time using Docker in a project (a Symfony project). In this project i don’t have any database, i just want to have the PHP version (8.3.1) and the projects dependencies.
This is the error i get when i do docker compose up –build :
1.025 Executing script cache:clear [KO]
1.031 [KO]
1.031 Script cache:clear returned with error code 1
1.031 !! Could not open input file: ./bin/console
1.031 !!
1.031 Script @auto-scripts was called via post-install-cmd
failed to solve: process "/bin/sh -c composer install –no-dev –no-interaction" did not complete successfully: exit code: 1
This is my Dockerfile :
FROM composer:lts as deps
WORKDIR /app
RUN --mount=type=bind,source=composer.json,target=composer.json
--mount=type=bind,source=composer.lock,target=composer.lock
--mount=type=cache,target=/tmp/cache
composer install --no-dev --no-interaction
FROM php:8.3.1-apache as final
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY --from=deps app/vendor/ /var/www/html/vendor
COPY src /var/www/html
USER www-data
This is my compose.yml file :
services:
server:
build:
context: .
ports:
– 9000:80
I tried to find a solution online but i found nothing recent related to Symfony with Docker
2
Answers
Thanks for your help carloliwanag, i had to add two lines to make it works.
This is my code right now :
It seemed to me that you are running composer install before copying your src folder to /var/www/html.
I would suggest to
In your case it will be something like: