Skip to content

Missing composer vendor folder #851

Closed

Description

@spriya757
No description provided.

Activity

  1. changed the title [-]Remove volume instruction[/-] [+]Missing composer vendor folder[/+] on Oct 19, 2023
  2. spriya757 commented on Oct 19, 2023

    @spriya757
    Author

    When using this image in our builds, we noticed that the vendor folder created by composer command in /var/www/html is being removed in the next layer.
    Noticed the image has a VOLUME instruction - https://github.com/docker-library/wordpress/blob/master/latest/php8.2/fpm/Dockerfile#L142. Removing this and rebuilding the base image fixed the problem.

  3. maiorano84 commented on Nov 14, 2023

    @maiorano84

    You're using Bedrock I'm assuming?

    You should use Multistage builds and copy your resulting files over to their respective locations. Here's a loose example of how we're doing it. There are better ways, but I slapped this together for illustrative purposes:

    ARG PHP_VERSION=8.1
    ARG NODE_VERSION=18
    
    # Step 1 -- Composer
    FROM php:${PHP_VERSION}-cli-alpine AS builder
    
    WORKDIR /app
    
    COPY --from=composer:2.3.3 /usr/bin/composer /usr/local/bin
    COPY composer.json composer.lock ./
    
    RUN composer install --no-dev
    
    # Step 2 -- Theme
    FROM node:${NODE_VERSION}-slim AS theme
    
    WORKDIR /theme
    
    COPY web/app/themes/custom-theme ./
    
    RUN npm install && npm run build
    
    # Step 3 -- PHP FPM
    FROM wordpress:php${PHP_VERSION}-fpm-alpine AS final
    
    COPY . .
    COPY --from=builder --chown=www-data:www-data /app ./
    COPY --from=theme --chown=www-data:www-data /theme/dist /var/www/html/web/app/themes/custom-theme/dist
    
    ENTRYPOINT ["php-fpm"]
    
  4. locked and limited conversation to collaborators on Nov 30, 2023
  5. converted this issue into a discussion #867 on Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions