-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (36 loc) · 1.16 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
48
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 \
postgresql-dev 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
# Install any extra dependencies via Aptfile - These are installed on Heroku
# COPY Aptfile /usr/src/app/Aptfile
# RUN apk add --update $(cat /usr/src/app/Aptfile | xargs)
ENV PATH /usr/src/app/bin:$PATH
# Install latest bundler
RUN bundle config --global silence_root_warning 1
EXPOSE 3000
CMD ["bundle", "exec", "hanami", "server", "--host=0.0.0.0", "--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