Based on https://docs.docker.com/compose/rails/
FROM ruby:2.5.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /site
WORKDIR /site
ADD Gemfile /site/Gemfile
ADD Gemfile.lock /site/Gemfile.lock
RUN bundle install
ADD . /site
That’ll put your application code inside an image that will build a container with Ruby, Bundler and all your dependencies inside it. For more information on how to write Dockerfiles, see the Docker user guide and the Dockerfile reference.
source 'https://rubygems.org'
gem 'middleman'
You’ll need an empty Gemfile.lock in order to build our Dockerfile.
touch Gemfile.lock
Finally, docker-compose.yml is where the magic happens. This file describes the services that comprise your app, and the configuration needed to expose the web app’s port.
version: '2'
services:
web:
build: .
command: bundle exec middleman --bind-address 0.0.0.0
volumes:
- .:/site
ports:
- "4567:4567"
With those three files in place, you can now generate your middleman site using docker-compose run:
docker-compose run web middleman init
In order to build the site, you need to run:
docker-compose run web middleman build
thanks for the writeup!