I want to dockerize my laravel application but I am getting this error
ERROR: for backend_php_1 Cannot start service php: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: “entrypoint.sh”: executable file not found in $PATH: unknown
Dockerfile
FROM php:8.2 as php
RUN apt-get update -y
RUN apt-get install -y unzip libpq-dev libcurl4-gnutls-dev
RUN docker-php-ext-install pdo pdo_mysql bcmath
#RUN pecl install -o -f redis
# && rm -rf /tmp/pear
# && docker-php-ext-enable redis
WORKDIR /var/www
COPY . .
COPY --from=composer:2.7.4 /usr/bin/composer /usr/bin/composer
ENV PORT=8000
ENTRYPOINT [ "entrypoint.sh" ]
docker-compose
version: "3.8"
services:
# PHP Service
php:
build:
context: .
target: php
args:
- APP_ENV=${APP_ENV}
environment:
- APP_ENV=${APP_ENV}
- CONTAINER_ROLE=app
working_dir: /var/www
volumes:
- ./:/var/www
ports:
- 8000:8000
depends_on:
- database
volumes:
db-data: ~
entrypoint.sh
#!/bin/bash
if [ ! -f "vendor/autoload.php" ]; then
composer install --no-progress --no-interaction
fi
if [ ! -f ".env" ]; then
echo "Creating env file for env $APP_ENV"
cp .env.example .env
else
echo "env file exists."
fi
role=${CONTAINER_ROLE:-app}
echo role
if [ "$role" = "app" ]; then
php artisan migrate
php artisan key:generate
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan serve --port=$PORT --host=0.0.0.0 --env=.env
exec docker-php-entrypoint "$@"
fi