forked from switch2osm/switch2osm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.prod
36 lines (25 loc) · 966 Bytes
/
Dockerfile.prod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# This file is used if building for Production environments
# It uses a multi-stage build to run jekyll to populate an nginx container
FROM ruby:2.7-alpine as build
# Add Gem build requirements
RUN apk add --no-cache g++ make libxml2-dev libxslt-dev
# Create app directory
WORKDIR /app
# Add Gemfile and Gemfile.lock
ADD Gemfile* /app/
# Install Gems
RUN gem update --system \
&& gem install bundler -v $(grep -F -A 1 'BUNDLED WITH' Gemfile.lock | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle config --global jobs $(nproc) \
&& bundle install --deployment --no-cache \
&& bundle clean
# Copy Site Files
COPY . .
ENV JEKYLL_ENV=production
# Run jekyll build site
RUN bundle exec jekyll build --verbose
#-------------------------------------------------
FROM nginx:stable-alpine as webserver
# Copy built site from build stage
COPY --from=build /app/_site /usr/share/nginx/html