我需要从带有配置文件的目录中提取内容。我需要将配置文件中的内容复制到docker容器中的文件中。我是否必须将该文件夹作为卷挂载到Docker容器上,然后最后卸载?
FROM php:7.2-apache
ARG DEPLOY_BRANCH
RUN apt-get update && apt-get install -y \
libssl-dev \
unzip \
git \
wget \
ssh
RUN apt-get install -y curl gnupg make g++ \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs
RUN git clone https://github.com/jbboehr/php-psr.git
WORKDIR php-psr
RUN phpize \
&& ./configure \
&& make \
&& make test \
&& make install
RUN git clone --depth=1 git://github.com/phalcon/cphalcon.git /cphalcon
WORKDIR /cphalcon/build
RUN ./install
RUN touch /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini \
&& touch /usr/local/etc/php/conf.d/psr.ini \
&& echo "extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/phalcon.so" >> /usr/local/etc/php/conf.d/docker-php-ext-phalcon.ini \
&& echo "extension=psr.so" >> /usr/local/etc/php/conf.d/psr.ini
RUN git clone https://project.git /opt/application
WORKDIR /opt/application/auto
RUN git checkout $DEPLOY_BRANCH
RUN touch /root/.ssh/authorized_keys / && chmod 666 /root/.ssh/authorized_keys
RUN echo "pull from file" >> /root/.ssh/authorized_keys
RUN npm install phantomjs
RUN a2enmod rewrite
RUN echo "
pull from file
" >> /etc/apache2/application.conf
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& apt-get purge -y --auto-remove
答案 0 :(得分:0)
您只需要使用ADD命令将本地文件添加到容器中即可:
ADD RELATIVE_PATH_TO_FOLDER_YOU_WANT_TO_ADD_CONTENT/* FOLDER_IN_CONTAINER/