Skip to content

Commit

Permalink
fix: user docker hub image to build image (#81)
Browse files Browse the repository at this point in the history
* fix: user docker hub image to build image
* fix: updates to new voca builds
* fix: deface precompilation
  • Loading branch information
froger committed Jul 3, 2024
1 parent 28b894c commit b259417
Show file tree
Hide file tree
Showing 10 changed files with 4,008 additions and 2,433 deletions.
22 changes: 10 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM git.octree.ch:4567/decidim/vocacity/system/decidim-0.27
FROM octree/voca-decidim:0.27
ENV PM2_RUN="decidim,sidekiq" \
ROOT="/home/decidim/app" \
NODE_ENV=development
NODE_ENV=development \
RAILS_ENV=production

WORKDIR $ROOT
RUN apt-get update -yq \
Expand All @@ -16,21 +17,18 @@ RUN apt-get update -yq \
# Configure bundle
&& cd $ROOT \
&& bundle config set path "vendor" \
&& bundle config set with "production" \
&& bundle config set without "development:test" \
&& bundle config set no_cache "true" \
&& bundle config set deployment "false" \
&& rm -rf vendor Gemfile.lock \
&& rm -rf vendor voca/Gemfile.lock \
&& rm -rf db/migrate/*

COPY ./contrib/01_mautic_entrypoint /docker-entrypoint.d/01_mautic_entrypoint
COPY ./contrib/99_recompile /docker-entrypoint.d/99_recompile
COPY --chown=decidim:decidim ./contrib/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --chown=decidim:decidim . $ROOT
RUN bundle install \
# Recompile assets.
&& bundle exec rails decidim:webpacker:install \
&& bundle exec rails decidim_decidim_awesome:webpacker:install \
&& npm ci \
&& bundle exec rails assets:precompile \
&& rm -rf node_modules
RUN export RAILS_SECRET_KEY_BASE=assets \
&& bundle install \
&& bundle config set deployment "true"

CMD ["pm2-runtime", "start", "/home/decidim/app/config/ecosystem.config.js", "--only", "$PM2_RUN"]
CMD ["/bin/bash", "-c", "pm2-runtime start /home/decidim/app/config/ecosystem.config.js --only $PM2_RUN"]
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.deface.enabled = ENV['DEFACE_ENABLED'] == 'true'

# Code is not reloaded between requests.
config.cache_classes = true
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/session_store.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Rails.application.config.session_store :active_record_store, :key => '_decidim_session'
Rails.application.config.session_store :active_record_store, :key => '_decidim_session'
14 changes: 14 additions & 0 deletions contrib/99_recompile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/sh
set -e
if [ ! -d "$ROOT/public/decidim-packs" ]
then
cd $ROOT
echo " compile assets"
NODE_ENV=development npm ci
bundle exec rails assets:precompile
rm -rf node_modules
echo " ✅ assets compiled"

else
echo " ✅ assets are already compiled"
fi
7 changes: 3 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
version: '3.3'
services:
decidim:
container_name: decidim
build: .
entrypoint: ""
ports:
- 8080:8080
volumes:
- bundle:/home/decidim/app/vendor
- .:/home/decidim/app
environment:
RAILS_ENV: production
NODE_ENV: production
Expand All @@ -21,8 +20,8 @@ services:
SMTP_ADDRESS: "mailer"
SMTP_PORT: "25"
SMTP_AUTHENTICATION: "none"
PM2_RUN: decidim,sidekiq
QUEUE_ADAPTER: sidekiq
PM2_RUN: decidim
QUEUE_ADAPTER: async
MEMCACHE_SERVERS: memcached:11211
links:
- pg
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/voca.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module Decidim
module Voca
def self.each_gem(&block)
voca_config_file = File.join(ENV.fetch("ROOT"), "config/voca.yml")
voca_config_file = File.join(ENV.fetch("ROOT"), "voca/voca.yml")
return unless File.exists? voca_config_file
gems = YAML.load_file(voca_config_file)["voca"]["gems"]
return if gems.nil?
Expand Down
26 changes: 24 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 13 additions & 15 deletions Gemfile → voca/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,45 @@ source "https://rubygems.org"

ruby RUBY_VERSION

gem "decidim", ENV.fetch("DECIDIM_VERSION", "0.27.6")
gem "decidim-templates", ENV.fetch("DECIDIM_VERSION", "0.27.6")

# gem "decidim-conferences", ENV.fetch("DECIDIM_VERSION", "0.27.3")
# gem "decidim-consultations", ENV.fetch("DECIDIM_VERSION", "0.27.3")
# gem "decidim-elections", ENV.fetch("DECIDIM_VERSION", "0.27.3")
# gem "decidim-initiatives", ENV.fetch("DECIDIM_VERSION", "0.27.3")
gem "decidim", "0.27.6"
# gem "decidim-conferences", "0.27.6"
# gem "decidim-consultations", "0.27.6"
# gem "decidim-elections", "0.27.6"
# gem "decidim-initiatives", "0.27.6"
# gem "decidim-templates", "0.27.6"

gem "bootsnap", "~> 1.3"

gem "puma", ">= 5.0.0"

gem "faker", "~> 2.14"
gem 'omniauth_openid_connect'

gem "wicked_pdf", "~> 2.1"

gem 'activerecord-session_store'

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri

gem "brakeman"
gem "decidim-dev", ENV.fetch("DECIDIM_VERSION", "0.27.6")
gem "decidim-dev", "0.27.6"
end

group :development do
gem "letter_opener_web", "~> 2.0"
gem "listen", "~> 3.1"
gem "spring", "~> 2.0"
gem "spring-watcher-listen", "~> 2.0"
gem "web-console", "~> 4.2"
gem "rubocop"
gem "rubocop-rspec"
gem "rubocop-faker"
end

group :production do
gem 'sidekiq'
end

gem "sidekiq"
gem "dalli"
gem "airbrake", "~> 13.0"

require File.join(ENV.fetch("ROOT"), "lib/decidim/voca.rb")
Decidim::Voca.each_gem do |gem_config, gem_attributes|
gem *gem_config, **gem_attributes
end

4 changes: 4 additions & 0 deletions config/voca.yml → voca/voca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ voca:
decidim-theme:
git: "https://git.octree.ch/decidim/vocacity/decidim-module-theme.git"
branch: "development"
activerecord-session_store:
version: "~> 2.0.0"
omniauth_openid_connect:
version: "~> 0.7.1"
Loading

0 comments on commit b259417

Please sign in to comment.