未验证 提交 779658de 编写于 作者: M Michael Bang 提交者: GitHub

Dockerfile: allow Docker to cache build steps (#1336)

- By having a `COPY . xx` step before installing dependencies, we rob
Docker of the opportunity to cache downloading and building dependencies
if we make any changes to any files in the repository. By copying only
Gemfiles before the build step, we only require Docker to rebuild
dependencies when the Gemfiles have changed.
Co-authored-by: NMatthew Peveler <matt.peveler@gmail.com>
上级 de961f53
......@@ -7,7 +7,8 @@ VOLUME /srv/slate/source
EXPOSE 4567
COPY . /srv/slate
COPY Gemfile .
COPY Gemfile.lock .
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
......@@ -17,8 +18,11 @@ RUN apt-get update \
&& bundle install \
&& apt-get remove -y build-essential \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& chmod +x /srv/slate/slate.sh
&& rm -rf /var/lib/apt/lists/*
COPY . /srv/slate
RUN chmod +x /srv/slate/slate.sh
ENTRYPOINT ["/srv/slate/slate.sh"]
CMD ["build"]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册