Skip to content

BuildService finding non-existent files to copy in Debian #662

@clifmo

Description

@clifmo

I'm using Docker to build and I just sort of expected this to work. I've tried multiple version of PHP, different Debian releases. In short, BuildService tries to copy a file named _media.css which is the name of the folder, and not one of the file contents.

I started using Alpine but PHP glob is a known issue. So it's interesting that this also relates to glob(). MediaFile.php:109

I haven't had a chance to debug it but I'm curious why the directory is being considered as an asset, and what I can do to avoid this. Composer wants ^8.1 but I get a composer platform check error on 8.1. What am I missing?

    protected static function getMediaAssetFiles(): array
    {
        return glob(Hyde::path(static::getMediaGlobPattern()), GLOB_BRACE) ?: [];
    }

    protected static function getMediaGlobPattern(): string
    {
        return sprintf(Hyde::getMediaDirectory().'/{*,**/*,**/*/*}.{%s}', implode(',',
            Config::getArray('hyde.media_extensions', self::EXTENSIONS)
        ));
    }
FROM php:8.2-cli-buster AS build-php

WORKDIR  /app

COPY . .

RUN php hyde build
> [4/4] RUN php hyde build:
0.143
0.143
0.143                           Building your static site!
0.143
0.143
0.147 Removing all files from build directory...
0.147
0.147 Transferring Media Assets...
0.152  0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%
0.156    ErrorException
0.156
0.156   copy(/app/_media/_media.css): Failed to open stream: No such file or directory
0.156
0.156   at vendor/hyde/framework/src/Framework/Services/BuildService.php:60
0.157      56▕         $this->comment('Transferring Media Assets...');
0.157      57▕         $this->withProgressBar(MediaFile::files(), function (string $identifier): void {
0.157      58▕             $sitePath = Hyde::siteMediaPath($identifier);
0.157      59▕             $this->needsParentDirectory($sitePath);
0.157   ➜  60▕             copy(Hyde::mediaPath($identifier), $sitePath);
0.157      61▕         });
0.157      62▕
0.157      63▕         $this->newLine(2);
0.157      64▕     }
0.157
0.157       +17 vendor frames
0.157
0.157   18  hyde:35
0.157       LaravelZero\Framework\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
0.157
------
Dockerfile:8
--------------------
   6 |
   7 |     #RUN php hyde publish:homepage posts -n
   8 | >>> RUN php hyde build

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