https://github.com/slatedocs/slate/wiki/Using-Slate-in-Docker
这里是通过docker构建静态网站的命令
先构建一个本地镜像
docker build -t slate-docs .
构建报错
27.55 ERROR: Error installing bundler:
27.55 The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.4.22. Try installing it with `gem install bundler -v 2.4.22`
27.55 bundler requires Ruby version >= 3.0.0. The current ruby version is 2.6.10.210.
Dockerfile把bundler版本改成2.4.22
yaml
FROM ruby:2.6-slim
WORKDIR /srv/slate
VOLUME /srv/slate/source
EXPOSE 4567
COPY . /srv/slate
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
nodejs \
&& gem install bundler -v 2.4.22\
&& bundle install \
&& apt-get remove -y build-essential \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
CMD ["bundle", "exec", "middleman", "server", "--watcher-force-polling"]
重新build镜像
docker build -t slate-docs .
将容器构建好的目录映射到当前build目录下
docker run --rm -v $(pwd)
:/srv/slate slate-docs bundle exec middleman build
最终推送,这里是预先配置好了git仓库,脚本读取当前git配置
./deploy.sh --push-only
需要安装bundle命令