-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
50 lines (39 loc) · 1.48 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
# Use ruby image to build our own image
FROM ruby:3.3.0
# Install dependencies
RUN apt-get update -qq && apt-get install -y postgresql-client libvips cron \
&& curl -sSL https://deb.nodesource.com/setup_18.x | bash - \
&& curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo 'deb https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y --no-install-recommends nodejs yarn
# Create work dir
RUN mkdir /app
WORKDIR /app
# Set build-time variables
ARG RAILS_ENV=production
ARG BUILDING_DOCKER_IMAGE=true
# This value is only set such that the asset precompile works. It
# will not be available to the final container and you need to
# set the value in your docker compose
ARG SECRET_KEY_BASE=583364b0aaaef81adc0d476c18efec0c
# Install gems, skipping the test and development gems
## Copy gemfiles
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
## Copy payment gateways
COPY payment_gateways/ /app/payment_gateways/
## Run bundle
RUN bundle config set --local without 'test development'
RUN bundle install
# Install yarn packages
COPY package.json /app/package.json
COPY yarn.lock /app/yarn.lock
RUN yarn install
# Add env var to enable YJIT
ENV RUBY_YJIT_ENABLE true
# Copy rails code
ADD . /app
# Precompile assets
RUN bundle exec rake assets:precompile
EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0"]