-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (35 loc) · 1.03 KB
/
Dockerfile
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
37
38
39
40
41
42
43
44
45
46
47
FROM ruby:2.7.2-alpine AS builder
LABEL maintainer="Mike Rogers <me@mikerogers.io>"
RUN apk add --no-cache \
#
# required
build-base libffi-dev \
nodejs yarn tzdata \
zlib-dev libxml2-dev libxslt-dev readline-dev bash \
# Nice to haves
git vim \
#
# Fixes watch file issues with things like HMR
libnotify-dev
FROM builder as development
# Add the current apps files into docker image
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/bin:$PATH
# Install latest bundler
RUN bundle config --global silence_root_warning 1
EXPOSE 3000
CMD ["middleman", "server", "--port", "3000"]
FROM development AS production
# Install Ruby Gems
COPY Gemfile /usr/src/app
COPY Gemfile.lock /usr/src/app
RUN bundle check || bundle install --jobs=$(nproc)
# Install Yarn Libraries
COPY package.json /usr/src/app
COPY yarn.lock /usr/src/app
RUN yarn install --check-files
# Copy the rest of the app
COPY . /usr/src/app
# Compile the assets
RUN RACK_ENV=production NODE_ENV=production middleman build