Skip to content

Commit

Permalink
Merge pull request #58 from octree-gva/fix/docker-setup
Browse files Browse the repository at this point in the history
ci: docker build and missing migrations
  • Loading branch information
RCheesley authored Jan 10, 2024
2 parents 98dd952 + 0aa3883 commit ae3acc7
Show file tree
Hide file tree
Showing 175 changed files with 3,894 additions and 1,280 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
vendor
tmp
.pm2
.bundle
.DS_Store
storage
Dockerfile*
docker-compose*
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Ignore bundler config.
/.bundle

.DS_Store
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-*
Expand Down Expand Up @@ -34,3 +34,7 @@

# Ignore public uploads
public/uploads
vendor
.bash_history
node_modules
.npm
2 changes: 1 addition & 1 deletion .pm2/touch
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1698196301572
1698228416828
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.0.6
ruby-3.0.0
9 changes: 0 additions & 9 deletions 00_mautic_entrypoint.sh

This file was deleted.

35 changes: 17 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
FROM hfroger/decidim:0.27 as build
FROM hfroger/decidim:0.27
ENV PM2_RUN="decidim,sidekiq" ROOT="/home/decidim/app"
FROM git.octree.ch:4567/decidim/vocacity/system/decidim-0.27
ENV PM2_RUN="decidim,sidekiq" \
ROOT="/home/decidim/app" \
DECIDIM_VERSION="0.27.5"

WORKDIR $ROOT
RUN apt-get update -yq \
# Install native deps
&& apt-get install -yq restic systemd rsyslog wget zip sharutils libicu-dev libpq-dev nginx \
&& apt-get install -yq nginx \
# Clean installation clutters
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log \
&& mkdir -p /etc/jelastic/\
&& mkdir -p $ROOT/tmp \
&& cd $ROOT \
&& npm install -g pm2 \
&& rm -rf /usr/local/bundle/cache \
# Add a nginx user
&& useradd -u 1002 -g 1001 -r -s /bin/sh nginx \
# Configure bundle
&& bundle config set --local path "vendor" \
&& bundle config set --local with "production" \
&& bundle config set --local no_cache "true" \
&& bundle config set --local deployment "true"
&& cd $ROOT \
&& bundle config set path "vendor" \
&& bundle config set with "production" \
&& bundle config set no_cache "true" \
&& bundle config set deployment "false" \
&& rm -rf vendor Gemfile.lock

COPY ./00_mautic_entrypoint.sh /usr/local/share/docker-entrypoint.d/00_mautic_entrypoint.sh
COPY --chown=nginx:decidim ./contrib/nginx/nginx.conf /etc/nginx/nginx.conf
USER decidim
COPY --from=build --chown=decidim:decidim $ROOT $ROOT
COPY ./contrib/01_mautic_entrypoint /usr/local/share/docker-entrypoint.d/01_mautic_entrypoint
COPY --chown=decidim:decidim ./contrib/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --chown=decidim:decidim . $ROOT
RUN bundle install

CMD ["pm2-runtime", "start", "/home/decidim/app/config/ecosystem.config.js", "--only", "$PM2_RUN"]
18 changes: 18 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM hfroger/decidim:0.27-dev
ENV RAILS_ENV=development \
NODE_ENV=development \
ROOT=/home/decidim/app
COPY . $ROOT

RUN cd $ROOT \
&& bundle config set without "" \
&& bundle config set path "vendor" \
&& bundle install \
&& npm install -D webpack-dev-server \
&& npm i

EXPOSE 3000
EXPOSE 3035

ENTRYPOINT ["bin/docker-entrypoint"]
CMD ["sleep", "infinity"]
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source "https://rubygems.org"

ruby RUBY_VERSION

gem "decidim", ENV.fetch("DECIDIM_VERSION", "0.27.3")
gem "decidim", ENV.fetch("DECIDIM_VERSION", "0.27.5")
# 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")
Expand All @@ -14,15 +14,11 @@ gem "decidim", ENV.fetch("DECIDIM_VERSION", "0.27.3")
gem "bootsnap", "~> 1.3"

gem "puma", ">= 5.0.0"
gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer", branch: "master"
gem "decidim-only_forms", git: "https://git.octree.ch/decidim/decidim-module-only_forms", branch: "release/0.27-stable"
gem "decidim-decidim_awesome", ">= 0.9"

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

gem "wicked_pdf", "~> 2.1"
gem "dalli", "~> 3.2"

gem 'decidim-sitemaps'

Expand All @@ -36,11 +32,15 @@ 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"
end

group :production do
gem 'sidekiq'
end

gem "dalli"
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
Loading

0 comments on commit ae3acc7

Please sign in to comment.