From 5e5bde548bc03f51b847b5a88cc615443a4ab5c1 Mon Sep 17 00:00:00 2001 From: Matt Pereira Date: Thu, 22 Jun 2023 16:54:35 -0700 Subject: [PATCH] Setup Docker for Local Development Environment (#125) --- Dockerfile | 14 ++++++++++++++ docker-compose.yml | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml 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