【问题标题】:How to install meteor on alpine如何在高山上安装流星
【发布时间】:2019-11-28 20:04:11
【问题描述】:

我正在尝试在 node:10-alpine3.9 上安装流星,但出现错误。请问,我错过了什么?谢谢。

我想安装流星 1.8.1,我基于 staeke/meteor-alpine

Dockerfile

FROM node:10-alpine3.9

ENV METEOR_VERSION=1.8.1
ENV METEOR_ALLOW_SUPERUSER=1

RUN adduser -D -u 1001 -h /home/meteor meteor

RUN apk add --update --no-cache bash

RUN export TEMP_PACKAGES="alpine-sdk libc6-compat python linux-headers" && \
    apk add --update --no-cache $TEMP_PACKAGES && \
    su - meteor -c "curl https://install.meteor.com/?release=${METEOR_VERSION} | sh" && \
    cd /home/meteor/.meteor/packages/meteor-tool/*/mt-os.linux.x86_64 && \
    cp scripts/admin/launch-meteor /usr/bin/meteor && \
    cd dev_bundle && \
    cd bin && \
    rm node  && \
    rm npm && \
    rm npx && \
    ln -s $(which node) && \
    ln -s $(which npm) && \
    ln -s $(which npx) && \
    cd ../mongodb/bin && \
    rm mongo mongod && \
    cd ../../lib && \
    sed -i '/sysctl\.h/d' node_modules/netroute/src/netroute.cc && \
    npm rebuild && \
    cd ~ && \
    ln -s /home/meteor/.meteor && \
    apk del $TEMP_PACKAGES

WORKDIR /home/meteor

sudo docker build -t jds-base:1.0.0 后出现错误。 好吧,这不是唯一的错误,因为还有其他一些错误(这么久)

Downloading Meteor distribution

Meteor 1.8.1 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified

Couldn't write the launcher script. Please either:

  (1) Run the following as root:
        cp "/home/meteor/.meteor/packages/meteor-tool/1.8.1/mt-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
  (2) Add "$HOME/.meteor" to your path, or
  (3) Rerun this command to try again.

Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.

> fibers@3.1.1 install /home/meteor/.meteor/packages/meteor-tool/.1.8.1.ani1yi.p0f9s++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers
> node build.js || nodejs build.js

`linux-x64-64-musl` exists; testing
Binary is fine; exiting

> kexec@3.0.0 install /home/meteor/.meteor/packages/meteor-tool/.1.8.1.ani1yi.p0f9s++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/kexec
> node-gyp rebuild

make: Entering directory '/home/meteor/.meteor/packages/meteor-tool/.1.8.1.ani1yi.p0f9s++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/kexec/build'
  CXX(target) Release/obj.target/kexec/src/kexec.o

【问题讨论】:

    标签: docker dockerfile alpine


    【解决方案1】:

    您可以尝试使用下面的 Docker 映像,它可以安装 Metro 但您无法运行,好像有一个 github issue 描述 alpine 不支持正确的metero,该问题被标记为功能请求。

    FROM node:10-alpine3.9
    ENV METEOR_VERSION=0.9.1
    ENV METEOR_ALLOW_SUPERUSER=1
    RUN apk add --update --no-cache bash curl build-base
    RUN curl https://install.meteor.com/ | /bin/sh
    RUN  /usr/local/bin/meteor --version
    
    

    但是如果在 alpine 中不支持,没必要把事情弄复杂,你可以运行 node slim。如果您关心的是尺寸,那么如果 alpine 未能满足要求,则没有太大区别。

    FROM node:10-buster-slim
    ENV METEOR_VERSION=1.8.1
    ENV LC_ALL=POSIX
    ENV METEOR_ALLOW_SUPERUSER=1
    RUN apt-get -yqq update \
        && DEBIAN_FRONTEND=noninteractive apt-get -yqq install \
            curl \
            g++ \
            make \
        && apt-get clean && rm -rf /var/lib/apt/lists/*
    RUN curl "https://install.meteor.com/?release=${METEOR_VERSION}" | /bin/sh
    ENV PATH=$PATH:/root/.meteor
    WORKDIR /app
    EXPOSE 3000
    ENTRYPOINT ["meteor"]
    

    输出:

    $ docker run -it --entrypoint bash --rm meteor -c "meteor --version"
    
    Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app directory will be incorrect if you ever attempt to perform any Meteor tasks as a normal user. If you need to fix your permissions,
    run the following command from the root of your project:
    
      sudo chown -Rh <username> .meteor/local
    
    Meteor 1.8.1
    
    

    【讨论】:

    • 感谢 Adiii,但我不明白,为什么你说 alpine 不支持正常流星?这里hub.docker.com/r/staeke/meteor-alpine 我们有meteor alpine 图像而我需要使用alpine 的原因是我的经理的一些安全要求(我要创建的这个图像是用于开发环境的)
    • 我当时查了这个,但是没有找到docker hub海报使用的基础镜像。所以我不会去寻找一个我找不到他们的基本图像的图像,这是另一个安全风险,基本图像会做什么?而且 github repo 没有开始也没有 conrtributor。github.com/staeke/meteor-alpine 如果您能够找到该图像的基本图像,则可以使用该图像。
    • 您的 alpine 示例缺少 ?release=${METEOR_VERSION} 子句。
    猜你喜欢
    • 2020-09-07
    • 2020-08-03
    • 2019-10-02
    • 1970-01-01
    • 2020-03-26
    • 1970-01-01
    • 2018-06-16
    • 1970-01-01
    • 2019-06-03
    相关资源
    最近更新 更多