2

如何passenger-install-nginx-module通过 Dockerfile 安装?

FROM ubuntu:14.04
MAINTAINER hgkim

RUN apt-get update \
    && apt-get install -y curl build-essential libpq-dev advancecomp gcc libpcre3 \
    libpcre3-dev zlib1g zlib1g-dev libssl-dev gifsicle jhead \
    jpegoptim libjpeg-progs optipng pngquant libzmq-dev libevent-dev python-dev \
    python-virtualenv python libcurl4-openssl-dev \
    && virtualenv circus && /circus/bin/pip install circus-web==0.5 \
    && ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime \
    && useradd -d /home/newbie -m -s /bin/bash newbie \
    && usermod -aG root newbie \
    && echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
    && curl -L -O http://sourceforge.net/projects/pmt/files/pngcrush/1.7.81/pngcrush-1.7.81.tar.gz \
    && tar xvzf pngcrush* \
    && cd pngcrush* \
    && make \
    && mv pngcrush /usr/local/bin/ \
    && cd / && curl -L https://github.com/kelseyhightower/confd/releases/download/v0.6.3/confd-0.6.3-linux-amd64 -o confd \
    && mv confd /usr/local/bin/confd && chmod +x /usr/local/bin/confd

USER newbie

RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 \
    && \curl -sSL https://get.rvm.io | bash -s stable \
    && /bin/bash -l -c "rvm install 2.1.0" \
    && /bin/bash -l -c "rvm use 2.1.0" \
    && echo "gem: --no-ri --no-rdoc" > /home/newbie/.gemrc

ENV PATH /home/newbie/.rvm/bin:/home/newbie/.rvm/gems/ruby-2.1.0/bin:/home/newbie/.rvm/gems/ruby-2.1.0@global/bin:/home/newbie/.rvm/rubies/ruby-2.1.0/bin:$PATH

RUN gem install passenger -v 4.0.55 \
    && rvmsudo passenger-install-nginx-module \
    --auto --prefix=/usr/local/nginx --auto-download --languages ruby

CMD bash

以上是我的dockerfile。

我只想设置passenger-nginx-module ...

但我RUN在 Dockerfile 的最后一条指令中出错

RUN gem install passenger -v 4.0.55 \
    && rvmsudo passenger-install-nginx-module \
    --auto --prefix=/usr/local/nginx --auto-download --languages ruby

首先,安装passenger,其次,尝试通过rvmsudo passenger-install-nginx-module命令安装nginx-module。

但是码头工人回应了这个错误

错误:

Unable to autodetect the currently active RVM gem set name. This could happen if you ran this program using 'sudo' instead of 'rvmsudo'. When using RVM, you're always supposed to use 'rvmsudo' instead of 'sudo!'.

Please try rerunning this program using 'rvmsudo'. If that doesn't help, please contact this program's author for support.

虽然我只是试图指挥rvmsudo......

我应该怎么办?

4

4 回答 4

1

尝试将 RUN Passenger-install-nginx-module 替换为

RUN /bin/bash -l -c 'passenger-install-nginx-module --auto-download --auto --prefix=/opt/nginx' 
于 2015-07-02T16:08:00.057 回答
0

user2105103 说了什么。你也可以只使用passenger-docker

于 2014-12-21T12:35:24.097 回答
0

试试这个 RUN Passenger-install-nginx-module --auto-download --auto --prefix=/opt/nginx

于 2015-01-27T06:34:53.973 回答
0

我确信有一种方法可以自动化配置/构建过程——但为什么呢?你知道passenger-install-nginx-module从源代码下载和编译nginx吗?

为什么不直接添加乘客 apt 存储库并通过 apt-get 安装它?容易多了。

乘客 Debian 安装指南

于 2014-12-19T15:57:09.863 回答