Docker Community Forums

Share and learn in the Docker community.

Trying to copy file from git project inside a docker container but I don't see it inside the container

build

(Metabsd) #1

I build this with docker build --rm -f Dockerfile -t briefmktg:latest .

# from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements
FROM php:7.2-fpm-alpine

ENV DRUSH_VERSION 9.x

# Update packages list
RUN apk --no-cache update

# Install mysql-client, necessary for drush
RUN apk add --no-cache mysql-client

# install the PHP extensions we need
# postgresql-dev is needed for https://bugs.alpinelinux.org/issues/3642
RUN set -ex \
	&& apk add --no-cache --virtual .build-deps \
		coreutils \
		freetype-dev \
		libjpeg-turbo-dev \
		libpng-dev \
		postgresql-dev \
	&& docker-php-ext-configure gd \
		--with-jpeg-dir=/usr/include/ \
		--with-png-dir=/usr/include/ \
	&& docker-php-ext-install -j "$(nproc)" \
		gd \
		opcache \
		pdo_mysql \
		pdo_pgsql \
		zip \
	&& runDeps="$( \
		scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
			| tr ',' '\n' \
			| sort -u \
			| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
	)" \
	&& apk add --virtual .drupal-phpexts-rundeps $runDeps \
	&& apk del .build-deps

# Configure /etc/postfix/main.cf
# RUN echo "relayhost = [$PHP_SENDMAIL_HOST]:$PHP_SENDMAIL_PORT" >> /etc/postfix/main.cf && \
#     echo "myhostname = $PHP_SENDMAIL_HOST" >> /etc/postfix/main.cf && \
#     echo "inet_interfaces = all" >> /etc/postfix/main.cf && \
#     echo "recipient_delimiter = +" >> /etc/postfix/main.cf

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
# Install Drush
RUN wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar && \
	chmod +x drush.phar && \
	mv drush.phar /usr/local/bin/drush

# 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

COPY --chown=www-data:www-data web/  /var/www/html/web
COPY --chown=www-data:www-data composer.json /var/www/html
COPY --chown=www-data:www-data config/ /var/www/html
COPY --chown=www-data:www-data drush/ /var/www/html
COPY --chown=www-data:www-data patches/ /var/www/html
COPY --chown=www-data:www-data scripts/ /var/www/html
COPY --chown=www-data:www-data translations/ /var/www/html
COPY --chown=www-data:www-data vendor/ /var/www/html

WORKDIR /var/www/html

RUN cd /var/www/html && composer build

EXPOSE 9000
CMD ["php-fpm", "-F"]


# vim:set ft=dockerfile:

I see my step running ok

Step 10/20 : COPY --chown=www-data:www-data web/  /var/www/html/web
 ---> 33aabc9651e0
Step 11/20 : COPY --chown=www-data:www-data composer.json /var/www/html
 ---> f6e3d3a7dd36
Step 12/20 : COPY --chown=www-data:www-data config/ /var/www/html
 ---> a2f2944702d2
Step 13/20 : COPY --chown=www-data:www-data drush/ /var/www/html
 ---> 2c9b6c48e44f
Step 14/20 : COPY --chown=www-data:www-data patches/ /var/www/html
 ---> d3d9bc446714
Step 15/20 : COPY --chown=www-data:www-data scripts/ /var/www/html
 ---> f066ccd4f693
Step 16/20 : COPY --chown=www-data:www-data translations/ /var/www/html
 ---> 4e68d8fce10c
Step 17/20 : COPY --chown=www-data:www-data vendor/ /var/www/html
 ---> d9d05e27267b
Step 18/20 : RUN cd /var/www/html && composer build
 ---> Running in 5628c0388ad9

I attach to the shell of the same container and make sure all the thing I want to copy are there but I don’t see scripts folder as example.

Thank you in advance for helping.


(Metabsd) #2

I have to specify the destination folder…

COPY --chown=www-data:www-data web/  /var/www/html/web
COPY --chown=www-data:www-data composer.json /var/www/html
COPY --chown=www-data:www-data config/ /var/www/html/config/
COPY --chown=www-data:www-data drush/ /var/www/html/drush/
COPY --chown=www-data:www-data patches/ /var/www/html/patches/
COPY --chown=www-data:www-data scripts/ /var/www/html/scripts/
COPY --chown=www-data:www-data translations/ /var/www/html/translations/
COPY --chown=www-data:www-data vendor/ /var/www/html/vendor/