2024-09-05 15:42:55 -04:00
|
|
|
FROM ruby:3.3.4-alpine
|
2024-03-15 18:31:06 -04:00
|
|
|
|
2024-09-17 18:53:29 -04:00
|
|
|
ENV APP_PATH=/var/app
|
2024-11-25 10:02:39 -05:00
|
|
|
ENV BUNDLE_VERSION=2.5.21
|
2024-09-17 18:53:29 -04:00
|
|
|
ENV BUNDLE_PATH=/usr/local/bundle/gems
|
|
|
|
|
ENV RAILS_LOG_TO_STDOUT=true
|
|
|
|
|
ENV RAILS_PORT=3000
|
2024-03-15 18:31:06 -04:00
|
|
|
|
|
|
|
|
# Install dependencies for application
|
|
|
|
|
RUN apk -U add --no-cache \
|
|
|
|
|
build-base \
|
|
|
|
|
git \
|
|
|
|
|
postgresql-dev \
|
|
|
|
|
postgresql-client \
|
|
|
|
|
libxml2-dev \
|
|
|
|
|
libxslt-dev \
|
|
|
|
|
nodejs \
|
|
|
|
|
yarn \
|
|
|
|
|
imagemagick \
|
|
|
|
|
tzdata \
|
|
|
|
|
less \
|
|
|
|
|
yaml-dev \
|
|
|
|
|
gcompat \
|
|
|
|
|
&& mkdir -p $APP_PATH
|
|
|
|
|
|
2025-01-09 08:44:16 -05:00
|
|
|
# Update gem system and install bundler
|
|
|
|
|
RUN gem update --system 3.6.2 \
|
|
|
|
|
&& gem install bundler --version "$BUNDLE_VERSION" \
|
2024-03-15 18:31:06 -04:00
|
|
|
&& rm -rf $GEM_HOME/cache/*
|
|
|
|
|
|
|
|
|
|
# Navigate to app directory
|
|
|
|
|
WORKDIR $APP_PATH
|
|
|
|
|
|
2025-01-08 07:06:50 -05:00
|
|
|
COPY ../Gemfile ../Gemfile.lock ../vendor ../.ruby-version ./
|
2024-03-15 18:31:06 -04:00
|
|
|
|
|
|
|
|
# Install missing gems
|
|
|
|
|
RUN bundle config set --local path 'vendor/bundle' \
|
2025-01-09 08:44:16 -05:00
|
|
|
&& if [ "$RAILS_ENV" = "production" ]; then \
|
|
|
|
|
bundle install --jobs 4 --retry 3 --without development test; \
|
|
|
|
|
else \
|
|
|
|
|
bundle install --jobs 4 --retry 3; \
|
|
|
|
|
fi
|
2024-03-15 18:31:06 -04:00
|
|
|
|
2025-01-08 07:06:50 -05:00
|
|
|
COPY ../. ./
|
2024-03-15 18:31:06 -04:00
|
|
|
|
2025-01-09 08:44:16 -05:00
|
|
|
# Precompile assets for production
|
|
|
|
|
RUN if [ "$RAILS_ENV" = "production" ]; then \
|
|
|
|
|
bundle exec rake assets:precompile \
|
|
|
|
|
&& rm -rf node_modules tmp/cache; \
|
|
|
|
|
fi
|
|
|
|
|
|
2024-09-17 18:53:29 -04:00
|
|
|
# Copy entrypoint scripts and grant execution permissions
|
2025-01-09 08:44:16 -05:00
|
|
|
COPY ./docker/web-entrypoint.sh /usr/local/bin/web-entrypoint.sh
|
|
|
|
|
RUN chmod +x /usr/local/bin/web-entrypoint.sh
|
|
|
|
|
|
|
|
|
|
COPY ./docker/sidekiq-entrypoint.sh /usr/local/bin/sidekiq-entrypoint.sh
|
|
|
|
|
RUN chmod +x /usr/local/bin/sidekiq-entrypoint.sh
|
2024-09-17 18:53:29 -04:00
|
|
|
|
2024-03-15 18:31:06 -04:00
|
|
|
EXPOSE $RAILS_PORT
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT [ "bundle", "exec" ]
|