用docker-compose启动ember-cli应用程序

时间:2015-11-03 00:14:12

标签: ember-cli dockerfile docker-compose

我正在尝试使用

运行我的ember-cli应用

'docker-compose up'命令,但收到以下错误..

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"]

这是我的docker-compose.yml

front-end:
    build: .
    ports:
      - "4200:4200"
    volumes:
      - .:/code

你能告诉我如何解决这个问题吗?另外,我确信我可以改进/优化我的Dockerfle ..我的Dockerfile上的任何反馈都会很棒..

2 个答案:

答案 0 :(得分:0)

我认为发生了什么VOLUMES /code正在保留您使用docker-compose rm -f而不是使用主机卷创建的音量。尝试运行VOLUMES /code删除旧容器,从Dockerfile移除up,然后再次尝试运行 .on('change', function() { $(this).valid(); });

答案 1 :(得分:0)

最后我得到了这个......

这是我的Dockerfile

var url = window.location.host+window.location.path';

和我的docker-compose.ml

FROM debian:wheezy

ENV DEBIAN_FRONTEND noninteractive

# Install dependencies.
RUN 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\
  python-dev \
  ruby-compass \
  texinfo \
  zlib1g-dev

RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -

RUN apt-get install -qy nodejs \
  npm

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN git clone https://github.com/facebook/watchman.git \
    && cd watchman \
    && git checkout v3.1 \
    && ./autogen.sh \
    && ./configure \
    && make \
    && make install

#install npm packages
RUN npm install -g bower \
  ember-cli

EXPOSE 4200

VOLUME /code
WORKDIR /code

CMD ["ember", "server"]

现在,我可以使用' docker-compose up'来启动我的ember-cli应用程序。命令。

然而这个泊坞窗图像大约是600MB ..有什么办法可以缩小图像的大小吗?