0

我曾尝试使用 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)并检查时,它将显示原始石板安装而不是我对源文件夹中 index.html.md 文件所做的修改更改。我路径中的构建文件夹也没有更新。

任何人都可以确定我在这里做错了什么?我是 Docker 新手。

谢谢。

4

1 回答 1

0

尝试这个:docker-compose up --build

于 2016-12-09T08:40:06.083 回答