Files
nairobi/Dockerfile
Javi Martín e74eff217b Upgrade Ruby to version 3.1.4
Note we updated the `mail` gem in commit 103742847, which is necesary
for Ruby 3.1 because it adds the net-smtp dependency. The net-smtp
library was removed from Ruby in Ruby 3.1, and if we don't include it,
we get an error:

```
cannot load such file -- net/smtp (LoadError)
```

We're also updating the Bundler version in the Gemfile.lock so it's the
one included in Ruby 3.1. Without updating it, we get a warning:

```
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)'
has been deprecated. Please call `DidYouMean.correct_error(error_nam e,
spell_checker)' instead.
```

Finally, in order to make Capistrano work, we need to add a couple more
changes:

* Make the net-ssh gem compatible with SSL 3.0; done in commit b2eec088b
* Explicitly allow aliases in the `deploy-secrets.yml` file because
  Psych 4.x (included in Ruby 3.1) doesn't load aliases without this
  option
2023-09-12 15:17:17 +02:00

56 lines
1.7 KiB
Docker

FROM ruby:3.1.4-buster
ENV DEBIAN_FRONTEND noninteractive
# Install essential Linux packages
RUN apt-get update -qq \
&& apt-get install -y \
build-essential \
cmake \
imagemagick \
libappindicator1 \
libindicator7 \
libpq-dev \
libxss1 \
memcached \
nodejs \
pkg-config \
postgresql-client \
shared-mime-info \
sudo \
unzip
# Install Chromium for E2E integration tests
RUN apt-get update -qq && apt-get install -y chromium
# Files created inside the container repect the ownership
RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \
&& adduser consul sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN echo 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin"' > /etc/sudoers.d/secure_path
RUN chmod 0440 /etc/sudoers.d/secure_path
# Define where our application will live inside the image
ENV RAILS_ROOT /var/www/consul
# Create application home. App server will need the pids dir so just create everything in one shot
RUN mkdir -p $RAILS_ROOT/tmp/pids
# Set our working directory inside the image
WORKDIR $RAILS_ROOT
# Use the Gemfiles as Docker cache markers. Always bundle before copying app src.
# (the src likely changed and we don't want to invalidate Docker's cache too early)
COPY Gemfile* ./
RUN bundle install
# Copy the Rails application into place
COPY . .
ENTRYPOINT ["./docker-entrypoint.sh"]
# Define the script we want run once the container boots
# Use the "exec" form of CMD so our script shuts down gracefully on SIGTERM (i.e. `docker stop`)
# CMD [ "config/containers/app_cmd.sh" ]
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]