amazon web services - Cache path issue when deploying Laravel app in Docker through Vapor - Stack Overflow

So I'm trying to deploy my laravel app through laravel vapor with docker to get the benefits of th

So I'm trying to deploy my laravel app through laravel vapor with docker to get the benefits of the larger storage, but when building the image in the deployment I get an error pointing to problems with the cache path.

This is what my Dockerfile setup, where I configure the cache creation, looks like:

# Base image
FROM php:8.2-fpm

# Install dependencies
RUN apt-get update && apt-get install -y \
    zip unzip curl git libpq-dev libpng-dev libonig-dev libxml2-dev libzip-dev \
    && docker-php-ext-install pdo pdo_mysql mbstring gd bcmath zip \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Composer
COPY --from=composer:2.6 /usr/bin/composer /usr/bin/composer

# Set the environment variable to allow Composer plugins in non-interactive mode
ENV COMPOSER_ALLOW_SUPERUSER=1

# Set working directory
WORKDIR /var/www

# Copy the project files
COPY . .

# Creating cache paths
RUN mkdir -p bootstrap/cache storage/framework/{sessions,views,cache} && \
    chmod -R 777 storage bootstrap/cache

RUN composer install --prefer-dist --no-dev --optimize-autoloader

RUN chmod -R 777 storage bootstrap/cache

RUN chown -R www-data:www-data /root/poser

USER www-data

As well as my dockercompose which doesn't seem to be an issue:

services:
  app:
    build: .
    container_name: laravel-app
    restart: always
    working_dir: /var/www
    volumes:
      - .:/var/www
    networks:
      - laravel
    environment:
      - APP_ENV=***
      - DB_HOST=***
      - DB_DATABASE=***
      - DB_USERNAME=***
      - DB_PASSWORD=***

  nginx:
    image: nginx:alpine
    container_name: laravel-nginx
    restart: always
    ports:
    - "8080:80"
    volumes:
    - .:/var/www
    - ./nginx.conf:/etc/nginx/conf.d/default.conf
    depends_on:
    - app
    networks:
    - laravel

networks:
    laravel:

The log result is:

lluminate\Foundation\ComposerScripts::postAutoloadDump
3.293 > /bin/true --ansi
3.294 > @php artisan ide-helper:generate
3.528 
3.532 In Compiler.php line 66:
3.532                                       
3.532   Please provide a valid cache path.  
3.532                                       
3.532 
3.537 Script @php artisan ide-helper:generate handling the post-autoload-dump event returned with error code 1
------
Dockerfile:28
--------------------
  27 |     # Run composer install for production and give permissions
  28 | >>> RUN sed 's_@php artisan package:discover_/bin/true_;' -i composer.json \
  29 | >>>     && composer install --ignore-platform-req=php --no-dev --optimize-autoloader \
  30 | >>>     && composer clear-cache \
  31 | >>>     && php artisan package:discover --ansi \
  32 | >>>     && chmod -R 775 storage \
  33 | >>>     && chown -R www-data:www-data storage \
  34 | >>>     && mkdir -p storage/framework/sessions storage/framework/views storage/framework/cache
  35 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c sed 's_@php artisan package:discover_/bin/true_;' -i composer.json     && composer install --ignore-platform-req=php --no-dev --optimize-autoloader     && composer clear-cache     && php artisan package:discover --ansi     && chmod -R 775 storage     && chown -R www-data:www-data storage     && mkdir -p storage/framework/sessions storage/framework/views storage/framework/cache" did not complete successfully: exit code: 1

What am I doing wrong and how should I handle the cache?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744741558a4591056.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信