diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7c54534 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# https://hub.docker.com/_/ruby +FROM ruby:3.0 + +# throw errors if Gemfile has been modified since Gemfile.lock +RUN bundle config --global frozen 1 + +WORKDIR /usr/src/app + +# copy gems first to cache bundle install +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +# copy whole repo into the image +COPY . . diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e0760d1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3' +services: + jekyll: + container_name: jekyll-server + build: + context: . + dockerfile: Dockerfile + image: merl-center:v1 + # host flag allows Jekyll server to be accessed from outside the container + command: bundle exec jekyll serve --livereload --host=0.0.0.0 + # volume allows changes to be seen on localhost immediately instead of having to delete and rebuild image + volumes: + - .:/usr/src/app + ports: + - 4000:4000 + - 35729:35729 # port for livereload