2025-02-05 12:56:06 -05:00
|
|
|
FROM ruby:3.4.1-bookworm
|
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
|
2025-01-09 14:51:19 -05:00
|
|
|
ENV RAILS_ENV=development
|
2024-03-15 18:31:06 -04:00
|
|
|
|
|
|
|
|
# Install dependencies for application
|
2025-02-05 12:56:06 -05:00
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
build-essential \
|
2024-03-15 18:31:06 -04:00
|
|
|
git \
|
|
|
|
|
postgresql-client \
|
2025-02-05 12:56:06 -05:00
|
|
|
libpq-dev \
|
2024-03-15 18:31:06 -04:00
|
|
|
libxml2-dev \
|
2025-02-01 13:49:57 -05:00
|
|
|
libxslt-dev \
|
2024-03-15 18:31:06 -04:00
|
|
|
nodejs \
|
2025-02-05 12:56:06 -05:00
|
|
|
npm \
|
2024-03-15 18:31:06 -04:00
|
|
|
imagemagick \
|
|
|
|
|
tzdata \
|
|
|
|
|
less \
|
2025-02-05 12:56:06 -05:00
|
|
|
libyaml-dev \
|
2025-02-05 15:57:34 -05:00
|
|
|
gcc-10 \
|
|
|
|
|
g++-10 \
|
2025-02-05 13:16:05 -05:00
|
|
|
make \
|
2025-02-05 14:25:34 -05:00
|
|
|
libgeos-dev \
|
|
|
|
|
libproj-dev \
|
2025-02-05 12:56:06 -05:00
|
|
|
&& npm install -g yarn \
|
|
|
|
|
&& apt-get clean \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
2025-02-05 15:23:46 -05:00
|
|
|
&& mkdir -p $APP_PATH \
|
2025-02-05 15:57:34 -05:00
|
|
|
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \
|
|
|
|
|
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
|
2024-03-15 18:31:06 -04:00
|
|
|
|
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/*
|
|
|
|
|
|
|
|
|
|
WORKDIR $APP_PATH
|
|
|
|
|
|
2025-01-09 14:51:19 -05:00
|
|
|
COPY ../Gemfile ../Gemfile.lock ../.ruby-version ../vendor ./
|
2024-03-15 18:31:06 -04:00
|
|
|
|
2025-02-05 15:57:34 -05:00
|
|
|
# Set environment variables for compilation
|
|
|
|
|
ENV CFLAGS="-O2 -pipe -fstack-protector-strong" \
|
|
|
|
|
CXXFLAGS="-O2 -pipe -fstack-protector-strong" \
|
|
|
|
|
MAKEFLAGS="-j2"
|
|
|
|
|
|
2025-02-05 15:23:46 -05:00
|
|
|
# Install all gems into the image with reduced parallelism for ARM64
|
2024-03-15 18:31:06 -04:00
|
|
|
RUN bundle config set --local path 'vendor/bundle' \
|
2025-02-05 15:23:46 -05:00
|
|
|
&& bundle config set --local jobs 2 \
|
|
|
|
|
&& bundle config set build.nokogiri --use-system-libraries \
|
2025-02-05 15:57:34 -05:00
|
|
|
&& bundle config build.racc --with-cflags="-O2 -pipe" \
|
|
|
|
|
&& bundle config build.oj --with-cflags="-O2 -pipe" \
|
2025-02-05 15:23:46 -05:00
|
|
|
&& bundle install --retry 3 \
|
2025-02-05 12:56:06 -05:00
|
|
|
&& rm -rf vendor/bundle/ruby/3.4.0/cache/*.gem
|
2024-03-15 18:31:06 -04:00
|
|
|
|
2025-01-09 14:51:19 -05:00
|
|
|
# Copy the rest of the application
|
2025-01-08 07:06:50 -05:00
|
|
|
COPY ../. ./
|
2024-03-15 18:31:06 -04:00
|
|
|
|
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" ]
|