Commit Graph

47 Commits

Author SHA1 Message Date
Javi Martín
03d8d9e96d Merge pull request #5859 from DominikPeters/chromium-driver-dockerfile
Add chromium-driver to Dockerfile
2025-03-01 19:16:09 +01:00
Dominik Peters
bbcdb6f086 Add chromium-driver to Dockerfile
In the documentation about using docker, it says:

> System tests also work out of the box, although they might fail the
> first time while the tool running the tests downloads the right
> version of Chromedriver (which is needed to run them), and only
> "headless" mode (with a browser running in the background) is
> supported, which is the mode you'd probably use more than 95% of the
> time anyway.  For example, to run the tests for the homepage:
>
> POSTGRES_PASSWORD=password docker-compose run app bundle exec \
> rspec spec/system/welcome_spec.rb

For me, as predicted, the tests fail the first time, but they continue
to fail after. The errors are of form:

```
Failure/Error: example.run
Selenium::WebDriver::Error::WebDriverError:
  unable to connect to /home/consul/.cache/selenium/chromedriver/linux64
  /132.0.6834.110/chromedriver 127.0.0.1:9515
  # /usr/local/bundle/gems/selenium-webdriver-4.25.0/lib/selenium
  # /webdriver/common/service_manager.rb:132:in `connect_until_stable'
  # ... omitted ...
  # ./spec/spec_helper.rb:41:in `block (3 levels) in <top (required)>'
  # /usr/local/bundle/gems/i18n-1.14.6/lib/i18n.rb:353:in `with_locale'
  # ./spec/spec_helper.rb:40:in `block (2 levels) in <top (required)>'
```

Installing chromium-driver in the Dockerfile fixed it for me.
2025-03-01 18:57:38 +01:00
taitus
352f702947 Upgrade Ruby to version 3.2.7 2025-02-14 14:50:57 +01:00
Javi Martín
453c4d2427 Upgrade Ruby to version 3.2.6 2025-01-09 17:15:33 +01:00
Javi Martín
cf6d9ce753 Add Ruby version to Gemfile
Since Bundler 2.4.19, including in Ruby 3.2.3, it's possible to define
the Ruby version in the Gemfile by indicating which file contains the
version [1].

There are at least two practical cases where this is an advantage.

First, people using RVM in development will no longer accidentally run
the application using the wrong Ruby version (which, before these
changes, might happen if they switch to a branch using a different Ruby
version and forget to run `rvm use` or exit the current folder and enter
it again) because they will get an error when trying to do so.

Second, people using services like Heroku no longer need to modify the
Gemfile.

The disadvantage is that, now, every time we update the Ruby version, we
have to remember to run `bundle` so our `Gemfile.lock` gets the new
version.

[1] https://github.com/rubygems/rubygems/releases/tag/bundler-v2.4.19
2025-01-09 17:14:42 +01:00
Javi Martín
b6ba27fe47 Use Debian Bookworm in our Dockerfile
Debian Bookworm was released in version 10 June 2023, and Bullseye
already received its final point release on August 2024 [1].

[1] https://lists.debian.org/debian-release/2024/07/msg00231.html
2024-12-09 14:13:46 +01:00
Javi Martín
9a17fe740c Correctly declare environment variables in Dockerfile
We were getting warnings in our CI:

> Legacy key/value format with whitespace separator should not be used
> LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy
> "ENV key value" format

So we're updating the code as mentioned in the Docker documentation [1]

[1] https://docs.docker.com/reference/build-checks/legacy-key-value-format/
2024-09-18 15:59:39 +02:00
Javi Martín
497c542082 Upgrade Ruby to version 3.2.5
So get the latest fixes in the 3.2.x series.

We're also updating the parser gem so we don't get any warnings.
2024-08-19 16:04:38 +02:00
Javi Martín
5f20b5baac Remove dependency on shared-mime-info
We don't use mimemagic since commit 7212657c0, so we don't need
shared-mime-info anymore.
2024-08-06 12:46:49 +02:00
Javi Martín
118a4dde89 Upgrade Ruby to version 3.2.4
As usual, we're upgrading the parser gem so we don't get warnings about
the Ruby version when running a rails console.
2024-06-17 15:18:40 +02:00
Javi Martín
7840c98660 Upgrade Ruby to version 3.2.3
As usual, we're updating the bundler version in our Gemfile.lock so it
uses the one included in Ruby 3.2.3, and we're also updating the
`parser` gem so it supports this version.
2024-04-11 17:59:40 +02:00
Javi Martín
bdcf074392 Use Debian Bullseye instead of Buster on Docker
Debian Bullseye was released in 2021 and Debian Buster only receives
security updates.

Note that the libindicator7 package is no longer available in this
distribution. However, we were only installing it in order to install
chromedriver, which we don't do since commit 59b625a5f, so we don't need
it anymore.
2023-10-18 18:08:31 +02:00
Javi Martín
ad166fba4c Setup NPM with an empty package.json file
Note that, even if we're excluding the `node_modules/` folder from
version control, we aren't adding it to Capistrano's shared folders
because, when `node_modules` is a symbolic link, NPM removes it when
running `npm install`.
2023-10-17 13:12:20 +02:00
Javi Martín
55ed40e182 Depend on a specific version of Node.js
We're choosing version 18 because if offers support for SSL 3, just
like Ruby 3.1 does.

Note we're symlinking a .nvmrc file as well, in order to make it
compatible with NVM. While the .nvmrc and .node-version files use
different formats, they both support the syntax we're using to
define the version.

The code to install Node.js in the Dockerfile is a simplification of the
code in the Rails Dockerfile template [1].

[1] https://github.com/rails/rails/blob/04c97aec8a/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt#L25
2023-10-17 13:11:58 +02:00
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
Javi Martín
6c8445e3d7 Upgrade Ruby to version 3.0.6
Note the structure of the Gemfile changes slightly because Ruby 3.0
includes a new version of the Bundler gem.
2023-04-13 16:41:07 +02:00
Javi Martín
47a5840c70 Upgrade Ruby to version 2.7.7
So get the latest fixes in the 2.7.x series.

We're also updating the parser gem so we don't get any warnings.
2022-12-21 15:57:02 +01:00
Javi Martín
107c856aea Upgrade Ruby to version 2.7.6
So get the latest fixes in the 2.7.x series.

We're also updating the parser gem so we don't get any warnings.
2022-06-03 20:03:39 +02:00
Javi Martín
d0f8a678ba Simplify entrypoint configuration 2022-04-08 16:13:09 +02:00
Javi Martín
6d163eb1bf Split line installing packages in Dockerfile
With one package in line and in alphabetic order, it's easier to see
which packages we're installing.

We're also applying the same formatting (taking from the Docker
documentation [1]) to other lines running multiple instructions.

[1] https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
2022-04-08 16:13:09 +02:00
Javi Martín
8c5e7121ef Combine apt statements in Dockerfile
Quoting the Docker documentation [1]:

> Always combine RUN apt-get update with apt-get install in the same RUN
> statement.
> (...)
> Using apt-get update alone in a RUN statement causes caching issues
> and subsequent apt-get install instructions fail.
> (...)
> Docker sees the initial and modified instructions as identical and
> reuses the cache from previous steps. As a result the apt-get update
> is not executed because the build uses the cached version. Because the
> apt-get update is not run, your build can potentially get an outdated
> version of the curl and nginx packages.
>
> Using RUN apt-get update && apt-get install -y ensures your Dockerfile
> installs the latest package versions with no further coding or manual
> intervention.

[1] https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
2022-04-08 16:13:09 +02:00
Javi Martín
1d9d5ef0cb Don't use the --full-index option in Dockerfile
The --full-index option seemed to be causing caching issues on some
systems.

Since we don't know the reason why this option was added in the first
place, it might have some advantages. However, some people have reported
problems getting "version can no longer be found" errors for some gems
in this step, and documentation for Docker and Rails doesn't mention
this option at all.
2022-04-08 16:13:09 +02:00
Javi Martín
2bf3cb4484 Install Chromium before running bundle in Docker
This way we won't have to reinstall Chromium every time we change the
Gemfile.
2022-04-08 16:13:09 +02:00
Javi Martín
e4bc2c99bf Remove dead link in Dockerfile
The referenced URL is no longer available.
2022-04-08 16:13:09 +02:00
Javi Martín
642b7b2d75 Group Gemfile orders in Dockerfile together
The blank line between each order made it harder to read this file, and
we can use a shortcut to include all gemfiles.
2022-04-08 16:13:09 +02:00
Javi Martín
f087d6f1ea Remove step to install Bundler in Dockerfile
I think we could have already done so when upgrading Ruby to version
2.6.x (which also included the Bundler gem), but since we didn't, now
that we've upgraded to Bundler 2.x it's probably a good moment.
2021-09-07 21:09:17 +02:00
Javi Martín
f2330bee2b Upgrade Ruby to version 2.7.4
Note this version includes Bundler 2, so we can finally upgrade.
2021-09-03 12:12:38 +02:00
Javi Martín
2c84f775d7 Explicitely use Debian Buster in Dockerfile
Debian Bullseye was released two days ago, and is now the default
distribution for the Docker image.

Our image isn't compatible with Debian Bullseye right now, and we
haven't done any testing with it, so for now we're staying with Buster.
2021-08-17 14:37:58 +02:00
Javi Martín
9222ea0cf6 Upgrade Ruby to version 2.6.8
So get the latest security fixes in the 2.6.x series and we can update
the parser gem without getting any warnings.
2021-08-09 01:14:08 +02:00
Javi Martín
a2113ae003 Upgrade Ruby to version 2.6.7
So get the latest security fixes in the 2.6.x series.
2021-05-20 16:43:56 +02:00
Senén Rodero Rodríguez
6de8c2abd7 Install shared-mime-info required to install the mimemagic gem 2021-04-15 13:12:09 +02:00
Senén Rodero Rodríguez
d95a3c4976 Install system packages required to install the pronto gem 2021-04-15 12:53:35 +02:00
Javi Martín
baa58335cb Use Ruby 2.6 in the Dockerfile
So we use the same version defined in our .ruby-version file. Besides,
some of the gems we use are not compatible with Ruby 2.4.
2021-04-15 12:53:35 +02:00
Javi Martín
59b625a5f9 Simplify chromedriver installation with webdrivers
This gem will automatically install chromedriver based on the installed
version of Chrome/Chromium.
2020-05-25 15:50:35 +02:00
Lucas Hiago
9bad819273 Update ruby version on dockerfile 2020-04-30 15:30:16 -03:00
Thomas
4d3dd12672 docker build . is failing on ruby:2.3.6
Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease Unable to find expected entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)
2019-04-06 15:57:40 +02:00
Marko Lovic
9cc1834fb5 Rollback chromedriver version used in Docker to 2.38
Our Docker image uses Chromium v57, which is not supported by
chromedriver versions after 2.38. See
https://bugs.chromium.org/p/chromedriver/issues/detail?id=2445

The reason that the version of chromium is so old is that our base
image ruby:2.3.6 (the standard image for Ruby 2.3.6 on DockerHub) is
built on Debian 8 (jessie), which was made obsolete over a year ago.

The best solution is probably to upgrade the application to Ruby 2.3.7
(if not later), so we can use the official ruby:2.3.7 image, which is
kept up-to-date (it has Chromium 68).

Alternatively, we could try to install Chromium from a more up-to-date
repository, but this is probably not worth the trouble.
2018-07-30 18:10:00 +02:00
Angel Perez
8c8668a83c Use ChromeDriver 2.40 when building container 2018-07-16 15:27:28 -04:00
Angel Perez
812b43a74b Replace deprecated chromium-browser package with chromium 2018-06-07 14:11:49 -04:00
Angel Perez
9836bb63c3 Install memcached when building Docker container 2018-06-07 14:11:16 -04:00
Angel Perez
45cbec7736 Set DEBIAN_FRONTEND as 'noninteractive' to fix debconf warnings 2018-06-07 14:11:16 -04:00
Angel Perez
ff1fced609 Update Dockerfile to install Headless Chrome 2018-06-07 14:11:16 -04:00
Juan Salvador Pérez García
8161045009 Docker/docker-compose enhancements
The following enhancements have been made to docker/docker-compose

* Fixed bug when building the image.
* docker-compose up starts the server
* Scaffolding inside the container respect the ownership of the files
outside it
* Volumes are tagged as 'delegated' in order to improve performance for
mac/windoze users.
* bundler stores packages in a volume. This whay new packages can be
added without rebuilding the image:

```bash
docker-compose run app bundle install
```
2018-06-01 15:51:06 +02:00
iagirre
af867028a7 Add imagemagick package to Docker configuration
Add imagemagick package to the Docker configuration so that
it's installed along with the others at the moment of configuring it.
2018-05-28 16:56:52 +02:00
Bertocq
95571d63db Fixes on docker usage instructions 2017-11-15 17:53:05 +01:00
Daniel
a715df3431 fix the warning of secret_key for devise 2017-11-15 08:10:14 -06:00
Daniel
3e42182551 added Dockerfile and docker-compose.yml 2017-11-14 04:33:05 -06:00