我試圖運行使用開始燼-CLI應用與碼頭工人,組成了
「泊塢窗,撰寫了」命令我燼-CLI應用程序,但得到以下錯誤..
front-end_1 | Future versions of Ember CLI will not support v0.10.25.
Please update to Node 0.12 or io.js.
front-end_1 | version: 1.13.8
front-end_1 | You have to be inside an ember-cli project in order to
use the serve command.
這裏是我的Dockerfile
#https://hub.docker.com/_/ubuntu/
FROM ubuntu:latest
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
ENV DEBIAN_FRONTEND noninteractive
# Create user docker so we don't have to run everything as root.
RUN useradd -d /home/docker -m -s /bin/bash docker
# Install dependencies.
RUN sudo apt-get update -q && apt-get install -qy\
autoconf \
autotools-dev \
build-essential\
chrpath \
curl \
git\
libbz2-dev \
libcurl4-openssl-dev \
libexpat-dev \
libfontconfig1-dev \
libncurses-dev \
libssl-dev \
m4\
nodejs-legacy \
npm \
python-dev \
ruby-compass \
texinfo \
zlib1g-dev
#install homebrew
USER docker
RUN ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
ENV PATH=$HOME/.linuxbrew/bin:$HOME/local/m4/bin:$PATH
ENV MANPATH=$HOME/.linuxbrew/share/man:$MANPATH
ENV INFOPATH=$HOME/.linuxbrew/share/info:$INFOPATH
RUN $HOME/.linuxbrew/bin/brew install watchman
USER root
#install npm packages
RUN npm install -g --save bower \
ember-cli
# Clean up after apt
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Code volume should be mounted here.
VOLUME /code
#ADD ./code /code
EXPOSE 4200
# Use baseimage-docker's init system so CMD doesn't have PID 1.
# https://github.com/phusion/baseimage-docker#running-a-one-shot-command-in-the-container
# ENTRYPOINT ["/sbin/my_init", "--quiet", "--skip-startup-files", "--skip-runit", "--"]
# Open shell as user docker by default.
CMD ["su", "docker"]
WORKDIR /code
# run ember server on container start
ENTRYPOINT ["/usr/local/bin/ember"]
CMD ["server"]
這裏是我的搬運工,compose.yml
front-end:
build: .
ports:
- "4200:4200"
volumes:
- .:/code
請問我可以告訴我如何解決這個問題?另外,我確信我可以改進/優化我的Dockerfle ..我的Dockerfile上的任何反饋也會很棒。
有關Dockerfile的一些注意事項:1)在單獨的運行命令中進行apt-get安裝後清理並不會縮小映像,它需要在與apt-get安裝相同的RUN步驟中進行2)您可能不需要'VOLUME/code',你可以在運行時創建一個主機卷。 3)你有兩個'CMD'條目,但你只能有一個。第一個沒有做任何事情。 – dnephin
thx !!清理完所有東西,並保存了大約40MB ..我的圖像大約550MB雖然.. – genwip
雅,清理並沒有做太多(我很少這樣做)。你可以做的其他事情來減少圖像方面:1)使用不同的基本圖像,debian基本圖像往往比ubuntu小很多2)你可以嘗試避免安裝程序自制軟件,並找到一種方法來建立一個二進制'看門人'在一個容器裏。然後只需curl來安裝二進制文件。 – dnephin