Skip to content

fix docker build #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2025
Merged

fix docker build #799

merged 1 commit into from
Jun 15, 2025

Conversation

Morantron
Copy link
Collaborator

@Morantron Morantron commented Jun 13, 2025

The following error shows up when running docker build . when precompiling assets.

------
 > [builder 18/21] RUN RAILS_ENV=production     SECRET_KEY_BASE=dummy     RAILS_MASTER_KEY=dummy     DB_ADAPTER=nulldb     bundle exec rails assets:precompile:
2.692 Error retrieving instance profile credentials: Failed to open TCP connection to 169.254.169.254:80 (execution expired)
2.700 bin/rails aborted!
2.700 Aws::Errors::MissingRegionError: No region was provided. Configure the `:region` option or export the region name to ENV['AWS_REGION'] (Aws::Errors::MissingRegionError)
2.700
2.700         raise Errors::MissingRegionError if region.nil? || region == ''
2.700               ^^^^^^^^^^^^^^^^^^^^^^^^^^
2.700 /app/app/models/user.rb:26:in `<class:User>'
2.700 /app/app/models/user.rb:1:in `<main>'
2.700 /app/config/routes.rb:11:in `block in <main>'
2.700 /app/config/routes.rb:4:in `<main>'
2.700 /app/config/environment.rb:5:in `<main>'
2.700 Tasks: TOP => environment
2.700 (See full trace by running task with --trace)
------

This is fixed by adding STORAGE_PROVIDER=local, since ActiveStorage is not needed at that point. This seems to be a bug in ActiveStorage that is fixed in future Rails versions.

After this is fixed, the folowing error shows up:

 > [builder 18/21] RUN RAILS_ENV=production     SECRET_KEY_BASE=dummy     RAILS_MASTER_KEY=dummy     DB_ADAPTER=nulldb     STORAGE_PROVIDER=local     bundle exec rails assets:precompile:
5.471 bin/rails aborted!
5.471 Uglifier::Error:  (Uglifier::Error)
5.471
5.471 Tasks: TOP => assets:precompile
5.471 (See full trace by running task with --trace)
------

This is fixed by replacing uglifier with terser, which accepts modern JS syntax and seems more actively maintained.

@Morantron Morantron mentioned this pull request Jun 13, 2025
@markets markets linked an issue Jun 15, 2025 that may be closed by this pull request
@markets markets merged commit ca76571 into develop Jun 15, 2025
4 of 5 checks passed
@markets markets deleted the fix-docker-build branch June 15, 2025 13:35
@markets
Copy link
Collaborator

markets commented Jun 15, 2025

Thank you so much @Morantron 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Docker build
2 participants