Dockerfile全局安装Meteor,而不是本地安装

时间:2017-06-23 10:37:23

标签: linux bash meteor docker dockerfile

我的Dockerfile在图像上安装Meteor。唯一的问题是当我登录非root用户并运行meteor时,它开始下载并在本地安装。因此它将meteor识别为命令,但无法立即运行我的应用程序代码。如何将其提供给非root用户。

enter image description here

FROM ubuntu:xenial

# update the system
RUN apt-get update && apt-get -y install curl \
    apt-utils \
    locales \
    nano \
    python

RUN curl https://install.meteor.com/ | sh

# Set the locale
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    locale-gen
ENV LANG en_US.UTF-8  
ENV LANGUAGE en_US:en  
ENV LC_ALL en_US.UTF-8 

# create a user
RUN useradd -ms /bin/bash dev
ENV HOME=/home
WORKDIR $HOME/dev

RUN chmod -R 777 ~
RUN chown -R dev: /home/dev
USER dev

2 个答案:

答案 0 :(得分:0)

您可以尝试创建用户并在安装meteor之前切换WORK_DIR

另外,您应该考虑使用此https://github.com/jshimko/meteor-launchpad

答案 1 :(得分:0)

更改用户后必须运行流星安装,否则将以root用户运行流星安装。

<script type="text/javascript">
    $(document).ready(function(){
        console.log(1+0);
        $.ajax({
            url: 'fetch.php',
            type: 'get',
            //type: 'post',
            dataType: 'JSON',
            success: function(response){
                var len = response.length;
                for(var i=0; i<len; i++){
                  var beacon = response[i].beacon;
                  var location = response[i].location;

                  var tr_str = "<tr>" +
                  "<td align='center'>" + beacon + "</td>" +
                  "<td align='center'> <span class='minutes'>00</span>:<span class='seconds'>00</span> </td>" +
                  "</tr>";

                  $("#userTable tbody").append(tr_str); 
                }
                setInterval(updateTable, 10000);
            }
        })
    })

    function updateTable() {
        console.log(1+1);
        $.ajax({
            url: 'fetch.php',
            type: 'get',
            //type: 'post',
            dataType: 'JSON',
            success: function(response){
                var len = response.length;
                for(var i=0; i<len; i++){
                  var beacon = response[i].beacon;
                  var location = response[i].location;

                  var tr_str = "<tr>" +
                  "<td align='center'>" + beacon + "</td>" +
                  "</tr>";

                  $("#userTable tbody").append(tr_str);
                  /*( i have been told this part is the issue as to why the cells get added rather than updated but im not sure how i need to correct it to resolve this issue)*/

                }        
            }
        });
     };
</script>