forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
70 lines (56 loc) · 1.96 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Make sure it matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=2.7.8
FROM ruby:${RUBY_VERSION}-alpine
RUN apk add --no-cache build-base \
libxml2-dev \
libxslt-dev \
mariadb-dev \
git \
tzdata \
nodejs yarn \
less \
bash \
docker \
docker-compose \
cmake \
g++ \
make \
libc6-compat \
libstdc++ \
ruby-dev \
libffi-dev \
openssl-dev \
&& mkdir /node_modules
# Rails app lives here
WORKDIR /app
# Set production environment
ARG RAILS_ENV="production"
ARG BUNDLE_WITHOUT="development test"
ENV RAILS_LOG_TO_STDOUT="1" \
RAILS_SERVE_STATIC_FILES="true" \
RAILS_ENV="${RAILS_ENV}" \
BUNDLE_PATH=/usr/local/bundle \
BUNDLE_WITHOUT="${BUNDLE_WITHOUT}"
# Update RubyGems and Bundler
RUN gem update --system 3.4.22 && \
gem install bundler:2.4.22
# Copy Gemfile and Gemfile.lock first
COPY Gemfile Gemfile.lock ./
# Install gems
RUN bundle config set --local build.nokogiri --use-system-libraries && \
bundle install --jobs 4 --retry 3
# Copy the rest of the application
COPY . .
# Install yarn packages and build
RUN yarn install && yarn build
# Copy configuration files
RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_production.rb && \
cp config/bioportal_config_env.rb.sample config/bioportal_config_development.rb && \
cp config/database.yml.sample config/database.yml
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile --gemfile app/ lib/
# Precompile assets
RUN SECRET_KEY_BASE_DUMMY="1" ./bin/rails assets:precompile
ENV BINDING="0.0.0.0"
EXPOSE 3000
CMD ["bash"]