从Docker获取(" dotting")shell脚本

时间:2018-06-07 20:49:42

标签: linux bash shell docker dockerfile

我正在尝试设置一个下载Phantomjs的泊坞窗图片,并在~/.bash_rc~/.profile中的路径中设置别名。以下是执行此操作的Dockerfile

FROM node:8.9.4

RUN mkdir -p /usr/src/app

RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 \
    && tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2

RUN mv phantomjs-2.1.1-linux-x86_64 /usr/src/app

WORKDIR /usr/src/app

COPY package*.json /usr/src/app/

RUN npm install

COPY . /usr/src/app

RUN  . usr/src/app/test.sh
RUN . ~/.bashrc
RUN . ~/.profile

EXPOSE 4219

CMD ["node_modules/casperjs/bin/casperjs","selftest"]

脚本test.sh也设置了环境变量。以下是该脚本的内容。

  #!/bin/sh

   echo "alias phantomjs='/usr/src/app/phantomjs-2.1.1-linux-x86_64/bin/phantomjs'" >> ~/.bashrc

   echo "PATH=\"$HOME/bin:$HOME/.local/bin:$PATH:/usr/src/app/phantomjs-2.1.1-linux-x86_64/bin\"" >> ~/.profile

但它现在返回此错误

 Step 10/16 : RUN . ~/.profile
    ---> Running in 87cdccc4fef7
    stdin: is not a tty

我该怎么做才能让这个脚本运行?

0 个答案:

没有答案