我正在尝试在我的容器上运行资产编译(在boot2docker上运行)。
我目前有一个pg数据库和Web应用程序容器的docker镜像。我不知道为什么预编译资产在成功构建后没有显示。
我的Dockerfile如下所示:
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential
# Postgres support
RUN apt-get install -y libpq-dev
# Nokogiri support
RUN apt-get install -y libxml2-dev libxslt1-dev
# JS runtime
RUN apt-get install -y nodejs
ENV APP_HOME /app
RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/tmp
RUN mkdir $APP_HOME/log
# Copy the Gemfile and Gemfile.lock into the image.
# Temporarily set the working directory to where they are.
WORKDIR /tmp
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
# Install ruby dependencies
RUN bundle install
# Add app to container
ADD . $APP_HOME
# Add container working directory
WORKDIR $APP_HOME
# Expose puma port
EXPOSE 3000
# Expose the assets directory
VOLUME /app/public
# Precompile js/scss assets
RUN bundle exec rake assets:precompile
# Run puma server
CMD bundle exec puma -C /app/puma.rb
搬运工-compose.yml
db:
image: postgres
web:
build: .
volumes:
- .:/app
- /mnt/docker/app/public:/app/public
links:
- db
environment:
VIRTUAL_HOST: app.dev
当我检查/mnt/docker/app/public
时,没有任何内容:(。