stf icon indicating copy to clipboard operation
stf copied to clipboard

run Dockerfile occurs some error.

Open Fred0218 opened this issue 8 years ago • 10 comments

I have read Dockerfile,only have two lines use -y option. someone can tell me why occurs this error? image

Fred0218 avatar Mar 19 '18 02:03 Fred0218

The culprit is "apt-get uninstall unmet -y" ...

thinkhy avatar Mar 24 '18 14:03 thinkhy

HI @thinkhy,thanks for your reply. I have try to remove unmet,but not make effect.

Fred0218 avatar Mar 28 '18 02:03 Fred0218

That's not our Dockerfile. You should post the entire Dockerfile here, but in principle we don't support third party setups.

sorccu avatar Mar 28 '18 03:03 sorccu

Hi sorccu,here is the Dockerfile link i used. https://github.com/openstf/stf/blob/master/Dockerfile

Fred0218 avatar Mar 28 '18 03:03 Fred0218

No it isn't. You've changed the Node.js package URL and you've got that weird unmet in there. Post the exact Dockerfile you're using.

sorccu avatar Mar 28 '18 03:03 sorccu

Because china network can't access some source url,so I change to china source url.

FROM ubuntu:16.04

Sneak the stf executable into $PATH.

ENV PATH /app/bin:$PATH

Work in app dir by default.

WORKDIR /app

Export default app port, not enough for all processes but it should do

for now.

EXPOSE 3000

Install app requirements. Trying to optimize push speed for dependant apps

by reducing layers as much as possible. Note that one of the final steps

installs development files for node-gyp so that npm install won't have to

wait for them on the first native module installation.

RUN export DEBIAN_FRONTEND=noninteractive RUN useradd --system
--create-home
--shell /usr/sbin/nologin RUN stf-build
RUN stf-build
useradd --system
--create-home
--shell /usr/sbin/nologin RUN stf RUN sed -i'' 's@http://mirrors.aliyun.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@' /etc/apt/sources.list RUN apt-get update RUN apt-get install wget python build-essential apt-utils -y RUN wget --progress=dot:mega
https://npm.taobao.org/mirrors/node/v8.9.3/node-v8.9.3-linux-x64.tar.xz RUN tar -xJf node-v*.tar.xz --strip-components 1 -C /usr/local RUN rm node-v*.tar.xz RUN su stf-build -s /bin/bash -c '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js install' RUN apt-get install libzmq3-dev libprotobuf-dev git graphicsmagick yasm -y RUN apt-get clean RUN rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Copy app source.

COPY . /tmp/build/

Give permissions to our build user.

RUN mkdir -p /app &&
chown -R stf-build:stf-build /tmp/build /app

Switch over to the build user.

USER stf-build

Run the build.

RUN set -x &&
cd /tmp/build &&
export PATH=$PWD/node_modules/.bin:$PATH &&
npm install --loglevel http &&
npm pack &&
tar xzf stf-.tgz --strip-components 1 -C /app &&
bower cache clean &&
npm prune --production &&
mv node_modules /app &&
npm cache clean &&
rm -rf ~/.node-gyp &&
cd /app &&
rm -rf /tmp/

Switch to the app user.

USER stf

Show help by default.

CMD stf --help

Fred0218 avatar Mar 28 '18 03:03 Fred0218

You’ve modified it quite a bit, it’s not functional anymore. Take a fresh copy and do nothing except replace the download URL.

sorccu avatar Mar 28 '18 04:03 sorccu

Many thanks! can you also post your Dockerfile here.

Fred0218 avatar Mar 28 '18 04:03 Fred0218

Take the Dockerfile you claimed you were using. It’s that one. This time, don’t modify it until you have it working.

sorccu avatar Mar 28 '18 04:03 sorccu

@Fred0218 For the Dockerfile, you only have to replace npm register with a local mirror in China:

   RUN npm install -g cnpm --registry=https://registry.npm.taobao.org

Here I use npm register from taobao, it's workable for me.

thinkhy avatar Mar 28 '18 05:03 thinkhy