我尝试使用Docker构建slate,但在编译源代码时,修改后的更改不会受到影响。在我的源代码路径中,我有以下文件。
Dockerfile
FROM debian:latest
MAINTAINER Fed
VOLUME /usr/src/app/source
EXPOSE 4567
RUN apt-get update && \
apt-get install -y ruby git ruby-dev make gcc zlib1g-dev nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN gem install bundler
RUN git clone https://github.com/tripit/slate.git /slate
WORKDIR "/slate"
RUN bundle install
CMD ["bundle", "exec", "middleman", "server", "--force-polling"]
搬运工-compose.yml
slate:
build: .
ports:
- 4567:4567
volumes:
- ./source:/slate/source
- ./build:/slate/build
生成文件
.PHONY: build
build:
docker-compose build
up:
docker-compose up
compile:
docker-compose run slate bundle exec middleman build --clean
当我尝试make compile输出时显示
docker-compose run slate bundle exec middleman build --clean
create build/stylesheets/screen.css
create build/stylesheets/print.css
create build/images/navbar.png
create build/images/logo.png
create build/fonts/slate.svg
create build/fonts/slate.woff
create build/fonts/slate.woff2
create build/fonts/slate.ttf
create build/fonts/slate.eot
create build/javascripts/all.js
create build/javascripts/all_nosearch.js
create build/index.html
Project built successfully
当我执行make build
时docker-compose build
Building slate
Step 1 : FROM debian:latest
---> 1b088884749b
Step 2 : MAINTAINER Fed
---> Using cache
---> f36ba5d1e018
Step 3 : VOLUME /usr/src/app/source
---> Using cache
---> d97292401c69
Step 4 : EXPOSE 4567
---> Using cache
---> 5ae0ecc71451
Step 5 : RUN apt-get update && apt-get install -y ruby git ruby-dev make gcc zlib1g-dev nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Using cache
---> c83e099e40ee
Step 6 : RUN gem install bundler
---> Using cache
---> 4cc13ce89152
Step 7 : RUN git clone https://github.com/tripit/slate.git /slate
---> Using cache
---> 1ec325b7dc6b
Step 8 : WORKDIR "/slate"
---> Using cache
---> 8cc73cafc405
Step 9 : RUN bundle install
---> Using cache
---> 150ed469b196
Step 10 : CMD bundle exec middleman server --force-polling
---> Using cache
---> 9c2142617887
Successfully built 9c2142617887
当我执行化妆时
docker-compose up
Starting docs_slate_1
Attaching to docs_slate_1
slate_1 | == The Middleman is loading
slate_1 | == View your site at "http://localhost:4567", "http://127.0.0.1:4567"
slate_1 | == Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
但是当我去浏览器(http://192.168.99.100:4567/- boot2docker ip)并检查然后它将显示原始的slate安装而不是我对源文件夹中的index.html.md文件所做的修改。我路径中的构建文件夹也没有更新。
任何人都可以确定我在这里做错了什么?我是Docker的新手。
感谢。
答案 0 :(得分:0)
试试这个:docker-compose up --build