简体   繁体   中英

Docker- .sh file not found in path

In my new Symfony application, I am trying to run docker-compose build when I get an error:

In my root bin folder I have the file from the error message. I am starting to question if this is a path problem? Can someone please help? Maybe it is something wrong with volume definition in the docker file I posted below.

 RUN /var/www/html/bin/app_build.sh: #19 0.164 /bin/sh: 1: /var/www/html/bin/app_build.sh: not found
version: "3.9"
services:
    app-www:
        container_name: app-www
        hostname: app-www
        restart: unless-stopped
        entrypoint: apache2-foreground
        build:
            context: .
            args:
                ENVIRONMENT: local
        volumes:
            - ./www:/var/www/html
            - ./.docker/.ssh:/root/.ssh
            - ./www/node_modules:/var/www/html/node_modules:rw,cached
            - ./www/vendor:/var/www/html/vendor:rw,cached
        ports:
            - "8080:80"
            - "8081:443"
        depends_on:
            - redis
    redis:
        image: redis:6.2-alpine
        restart: always
        ports:
            - '6363:6379'
        command: redis-server --save 20 1 --loglevel warning
        volumes:
            - cache:/data
volumes:
    cache:
        driver: local

and dockerfile

FROM php:7.4-apache
ENV TZ="Europe/Zurich"
ARG COMPOSER_TOKEN
ENV COMPOSER_TOKEN=${COMPOSER_TOKEN}

# Debian Packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
    && apt-get --yes --no-install-recommends install libxml2-dev libgmp-dev zip npm zlib1g-dev libpng-dev libonig-dev git unzip tzdata \
    && npm install --global yarn

# PHP Extensions
RUN docker-php-ext-install soap bcmath gmp pdo pdo_mysql intl opcache gd json mbstring gmp \
    && docker-php-ext-enable soap bcmath gmp pdo pdo_mysql intl opcache gd json mbstring gmp \
    && pecl install xdebug \
    && pecl install redis \
    && docker-php-ext-enable xdebug redis

# Install composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN mkdir /root/.composer && echo "${COMPOSER_TOKEN}" > /root/.composer/auth.json

# Configure PHP
COPY ./config/docker/php/php.ini /usr/local/etc/php/php.ini

# Configure Apache
RUN a2enmod headers
RUN a2enmod rewrite
RUN a2enmod ssl
RUN rm -rf /etc/apache2/sites-enabled/* /etc/apache2/sites-available/
COPY ./config/docker/apache2/breitling.conf /etc/apache2/sites-enabled
COPY ./config/docker/apache2/ssl/ /etc/apache2/ssl/

# Deploy & Build app
COPY . /var/www/html/
RUN /var/www/html/bin/app_build.sh

# Fix permissions
RUN chmod -R 777 /var/www/html/var/

EXPOSE 80 443

ENTRYPOINT /var/www/html/bin/entrypoint.sh

I am not sure what is wrong as this is the main config for my project. And I am running it on MacOs.

After looking into these lines:

COPY . /var/www/html/
RUN /var/www/html/bin/app_build.sh

I would expect that inside path /var/www/html/ there is again www directory.

My guess is that you need only the contents of the www dir copied into the docker image. Then your copy command should look like this:

COPY ./www/ /var/www/html/

Give it a shot:-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM