mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
71 lines
2 KiB
Docker
71 lines
2 KiB
Docker
FROM ruby:3.4.1-bookworm
|
|
|
|
ENV APP_PATH=/var/app
|
|
ENV BUNDLE_VERSION=2.5.21
|
|
ENV BUNDLE_PATH=/usr/local/bundle/gems
|
|
ENV RAILS_LOG_TO_STDOUT=true
|
|
ENV RAILS_PORT=3000
|
|
ENV RAILS_ENV=development
|
|
|
|
# Install dependencies for application
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
git \
|
|
postgresql-client \
|
|
libpq-dev \
|
|
libxml2-dev \
|
|
libxslt-dev \
|
|
nodejs \
|
|
npm \
|
|
imagemagick \
|
|
tzdata \
|
|
less \
|
|
libyaml-dev \
|
|
gcc-10 \
|
|
g++-10 \
|
|
make \
|
|
libgeos-dev \
|
|
libproj-dev \
|
|
&& npm install -g yarn \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& mkdir -p $APP_PATH \
|
|
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \
|
|
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
|
|
|
|
# Update gem system and install bundler
|
|
RUN gem update --system 3.6.2 \
|
|
&& gem install bundler --version "$BUNDLE_VERSION" \
|
|
&& rm -rf $GEM_HOME/cache/*
|
|
|
|
WORKDIR $APP_PATH
|
|
|
|
COPY ../Gemfile ../Gemfile.lock ../.ruby-version ../vendor ./
|
|
|
|
# Set environment variables for compilation
|
|
ENV CFLAGS="-O2 -pipe -fstack-protector-strong" \
|
|
CXXFLAGS="-O2 -pipe -fstack-protector-strong" \
|
|
MAKEFLAGS="-j2"
|
|
|
|
# Install all gems into the image with reduced parallelism for ARM64
|
|
RUN bundle config set --local path 'vendor/bundle' \
|
|
&& bundle config set --local jobs 2 \
|
|
&& bundle config set build.nokogiri --use-system-libraries \
|
|
&& bundle config build.racc --with-cflags="-O2 -pipe" \
|
|
&& bundle config build.oj --with-cflags="-O2 -pipe" \
|
|
&& bundle install --retry 3 \
|
|
&& rm -rf vendor/bundle/ruby/3.4.0/cache/*.gem
|
|
|
|
# Copy the rest of the application
|
|
COPY ../. ./
|
|
|
|
# Copy entrypoint scripts and grant execution permissions
|
|
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
|
|
|
|
EXPOSE $RAILS_PORT
|
|
|
|
ENTRYPOINT [ "bundle", "exec" ]
|