Merge pull request #38 from ZeusWPI/docker

Add dockerfile
This commit is contained in:
mcbloch 2020-08-29 15:21:46 +02:00 committed by GitHub Enterprise
commit 60b6383382
3 changed files with 42 additions and 1 deletions

32
Dockerfile Normal file
View file

@ -0,0 +1,32 @@
# ------- Build -------
FROM ruby:2.7.1-alpine3.11 AS build
RUN apk add build-base
RUN mkdir -p /app
WORKDIR /app
COPY Gemfile .
COPY Gemfile.lock .
RUN bundle config set deployment 'true'
RUN bundle config set without 'development'
RUN bundle install
COPY content content/
COPY layouts layouts/
COPY lib lib/
COPY Guardfile .
COPY Rules .
COPY nanoc.yaml .
RUN bundle exec nanoc
# ------- Release -------
FROM nginx:latest AS release
RUN rm -rf /usr/share/nginx/html/*
COPY --from=build /app/output /usr/share/nginx/html
ENTRYPOINT ["nginx", "-g", "daemon off;"]

View file

@ -3,7 +3,6 @@ source 'https://rubygems.org'
gem 'adsf'
gem 'autoprefixer-rails'
gem 'byebug'
gem 'htmlcompressor'
gem 'kramdown'
gem 'mini_racer'
@ -16,3 +15,7 @@ group :nanoc do
gem 'guard-nanoc'
gem 'guard-livereload'
end
group :development do
gem 'byebug'
end

View file

@ -6,3 +6,9 @@ Durf Doen 2.0
1. Install bundler (`gem install bundler`)
2. Install other gems (`bundle install`)
3. Build and serve the site (`bundle exec nanoc live`)
### Optional setup via docker
You can run the code in a separated docker environment. It compiles the code and serves the files via nginx.
docker build --tag durfdoen2 . && docker run --publish 8080:80 --detach --name dd durfdoen2