forked from wyeworks/nucore-open
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
46 lines (33 loc) · 1.29 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
FROM ruby:2.5.5 as base
WORKDIR /app
ENV BUNDLE_PATH /gems
# Install NodeJS based on https://github.com/nodesource/distributions#installation-instructions
RUN apt-get update && \
# Installs the node repository
curl -sL https://deb.nodesource.com/setup_14.x | bash && \
# Installs the node repository
apt-get install --yes nodejs libmariadb-dev-compat && \
apt-get autoremove -y
# Copy just what we need in order to bundle
COPY Gemfile Gemfile.lock .ruby-version /app/
# We reference the engines in the Gemfile, so we need them to be there, too
COPY vendor/engines /app/vendor/engines
# Install version of Bundler used in Gemfile.lock
RUN gem install bundler --version=$(cat Gemfile.lock | tail -1 | tr -d " ")
# Force ruby platform to avoid nokogiri issue on Apple silicon
RUN bundle config set force_ruby_platform true
# Build bundle
RUN bundle install
# Copy application code base into image
COPY . /app
RUN cp config/database.yml.mysql.template config/database.yml && \
cp config/secrets.yml.template config/secrets.yml
EXPOSE 3000
CMD ["bundle", "exec", "puma", "-p", "3000"]
FROM base as develop
ENTRYPOINT ["./docker-entrypoint.sh"]
FROM base as deploy
ENV RAILS_ENV production
RUN bundle install --without=development test
# asset compile
RUN SECRET_KEY_BASE=fake bundle exec rake assets:precompile