Skip to content

Commit ad1952a

Browse files
committed
Add docker env
1 parent 819ebe4 commit ad1952a

4 files changed

Lines changed: 192 additions & 136 deletions

File tree

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Make sure it matches the Ruby version in .ruby-version and Gemfile
2+
ARG RUBY_VERSION=3.2.2
3+
FROM ruby:$RUBY_VERSION
4+
5+
# Install libvips for Active Storage preview support
6+
RUN apt-get update -qq && \
7+
apt-get install -y build-essential libvips && \
8+
apt-get clean && \
9+
rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man
10+
11+
# Rails app lives here
12+
WORKDIR /rails
13+
14+
# Set production environment
15+
ENV RAILS_LOG_TO_STDOUT="1" \
16+
RAILS_SERVE_STATIC_FILES="true" \
17+
RAILS_ENV="production" \
18+
BUNDLE_WITHOUT="development"
19+
20+
# Install application gems
21+
COPY Gemfile Gemfile.lock ./
22+
RUN bundle install
23+
24+
# Copy application code
25+
COPY . .
26+
27+
# Precompile bootsnap code for faster boot times
28+
RUN bundle exec bootsnap precompile --gemfile app/ lib/
29+
30+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
31+
RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile
32+
33+
# Entrypoint prepares the database.
34+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
35+
36+
# Start the server by default, this can be overwritten at runtime
37+
EXPOSE 3000
38+
CMD ["./bin/rails", "server"]

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
33

44
ruby "3.2.2"
55

6-
gem "rails", "~> 7.1.0"
6+
gem "rails", "~> 7.1.4"
77

88
gem "chronic", "~> 0.10.2"
99

0 commit comments

Comments
 (0)