Running Gulp with one command (like docker-compose exec)

Hello,

I’m fairly new to Docker but have been liking it much more than other similar systems.

I’m running a Drupal 8 project in Docker the only problem I’m having is getting Gulp to run in the theme directory. I’ve got it installed and am able to bash into the container, move to the theme directory then run Gulp but can’t seem to do it from one exec command. Every time I try it just says the file or directory doesn’t exist, but it does exist when I bash in to the container so I’m guessing when I try running cd as an exec command it its trying to do it on my local system?

I’m unsure how to proceed with this, what I want to do is run one command and run Gulp from the container.

Also the spaces in the http:// parts of URLs below is because the forum is restricting me on how many URLs I can place in a single post.

Here is the command I’m trying to run docker-compose exec web bash "cd /var/www/html/web/themes/material_admin"; gulp --version

Here is my Dockerfile:
FROM php:7.2-apache

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo 'xdebug.remote_host=docker.for.mac.localhost' >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo 'xdebug.remote_handler=dbgp' >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo 'xdebug.remote_mode=req' >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo 'xdebug.remote_autostart=1' >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo 'xdebug.idekey=PHPSTORM' >> /usr/local/etc/php/conf.d/xdebug.ini

RUN apt update; \
apt install -y \
git \
mysql-client

# install the PHP extensions we need
RUN set -ex; \
\
if command -v a2enmod; then \
	a2enmod rewrite; \
fi; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
	libjpeg-dev \
	libpng-dev \
	libpq-dev \
	unzip \
	git \
; \
\
curl -sS https:/ /getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-install -j "$(nproc)" \
	gd \
	opcache \
	pdo_mysql \
	pdo_pgsql \
	zip \
; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
	| awk '/=>/ { print $3 }' \
	| sort -u \
	| xargs -r dpkg-query -S \
	| cut -d: -f1 \
	| sort -u \
	| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*

# set recommended PHP.ini settings
# see https:/ /secure.php.net/manual/en/opcache.installation.php
RUN { \
	echo 'opcache.memory_consumption=128'; \
	echo 'opcache.interned_strings_buffer=8'; \
	echo 'opcache.max_accelerated_files=4000'; \
	echo 'opcache.revalidate_freq=60'; \
	echo 'opcache.fast_shutdown=1'; \
	echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

RUN apt update; \
apt install gnupg -y; \
apt install gnupg1 -y; \
apt install gnupg2 -y; \
cd ~; \
curl -sL https:/ /deb.nodesource.com/setup_10.x -o nodesource_setup.sh; \
bash nodesource_setup.sh; \
apt install nodejs -y; \
npm install gulp-cli -g -y; \
curl -sS https:/ /dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - ;\
echo "deb https:/ /dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \
apt update && apt install yarn -y;

WORKDIR /var/www/html/web/themes/material_admin

RUN yarn install;

WORKDIR /var/www/html

When I try this command docker-compose exec web --workdir="/var/www/html/web/themes/material_admin" gulp --version I just get an error saying OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"--workdir=/var/www/html/web/themes/material_admin\": stat --workdir=/var/www/html/web/themes/material_admin: no such file or directory": unknown": unknown but when I bash into the container using docker-compose exec web bash` I can cd into that directory so it must exist.