2020-06-21 08:42:08 +02:00
|
|
|
IMAGE decidim_0.21.0-200621
|
2020-06-21 08:32:40 +02:00
|
|
|
FROM alpine3.11-ruby2.6_2.6.5-200621
|
2019-11-15 18:00:26 +01:00
|
|
|
|
2019-11-17 17:36:25 +01:00
|
|
|
# https://github.com/Platoniq/decidim-install/blob/master/decidim-bionic.md
|
|
|
|
# https://github.com/Platoniq/decidim-install/blob/master/basic-config.md
|
|
|
|
|
2019-11-15 18:00:26 +01:00
|
|
|
ENV RAILS_ENV production
|
|
|
|
|
|
|
|
RUN EOF
|
|
|
|
# Install runtime dependencies
|
2020-03-12 23:54:17 +01:00
|
|
|
apk --no-cache add curl imagemagick libpq nodejs pcre procps tzdata
|
2019-11-15 18:00:26 +01:00
|
|
|
|
|
|
|
# Install build dependencies
|
2019-11-23 18:11:18 +01:00
|
|
|
apk --no-cache add --virtual .deps build-base curl-dev icu-dev libxml2-dev libxslt-dev linux-headers pcre-dev postgresql-dev zlib-dev
|
2019-11-15 18:00:26 +01:00
|
|
|
|
|
|
|
# Install passenger
|
2019-11-17 17:36:25 +01:00
|
|
|
gem install passenger --no-document
|
2019-11-15 18:00:26 +01:00
|
|
|
|
2019-11-23 18:11:18 +01:00
|
|
|
# Create OS user
|
2019-12-18 10:14:14 +01:00
|
|
|
addgroup -S -g 8080 decidim
|
|
|
|
adduser -S -u 8080 -h /srv/decidim-app -s /sbin/nologin -G decidim -g decidim decidim
|
2019-11-23 18:11:18 +01:00
|
|
|
|
|
|
|
# Compile nginx
|
2020-06-21 10:45:12 +02:00
|
|
|
# Minimized version of /usr/local/bin/passenger-install-nginx-module
|
|
|
|
NGINX_VERSION=$(grep ' PREFERRED_NGINX_VERSION' /usr/local/lib/ruby/gems/2.6.0/gems/passenger-*/src/ruby_supportlib/phusion_passenger.rb | grep -Eo '([0-9\.]+)')
|
2019-11-23 18:11:18 +01:00
|
|
|
cd /tmp
|
2020-06-21 10:45:12 +02:00
|
|
|
wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
|
|
|
|
tar xf nginx-*.tar.gz
|
|
|
|
cd nginx-*
|
2019-11-23 18:11:18 +01:00
|
|
|
./configure \
|
|
|
|
--prefix=/var/lib/nginx \
|
|
|
|
--sbin-path=/usr/sbin/nginx \
|
|
|
|
--conf-path=/etc/nginx/nginx.conf \
|
|
|
|
--pid-path=/run/nginx.pid \
|
|
|
|
--lock-path=/run/nginx.lock \
|
|
|
|
--user=decidim \
|
|
|
|
--group=decidim \
|
|
|
|
--with-threads \
|
|
|
|
--with-file-aio \
|
|
|
|
--with-http_ssl_module \
|
|
|
|
--with-http_v2_module \
|
|
|
|
--with-http_realip_module \
|
|
|
|
--with-http_gzip_static_module \
|
|
|
|
--with-http_stub_status_module \
|
|
|
|
--with-http_addition_module \
|
|
|
|
--with-cc-opt=-Wno-error \
|
2020-06-21 10:45:12 +02:00
|
|
|
--add-module=/usr/local/lib/ruby/gems/2.6.0/gems/passenger-*/src/nginx_module
|
2019-11-23 18:11:18 +01:00
|
|
|
make -j $(getconf _NPROCESSORS_ONLN)
|
|
|
|
make install
|
|
|
|
rm -f /etc/nginx/*.default
|
|
|
|
|
2019-11-15 18:00:26 +01:00
|
|
|
# Install Decidim
|
|
|
|
bundle config build.nokogiri --use-system-libraries
|
2020-03-17 09:18:13 +01:00
|
|
|
gem install bundler:1.17.3
|
2019-11-15 18:00:26 +01:00
|
|
|
gem install decidim
|
|
|
|
cd /srv
|
|
|
|
decidim decidim-app
|
|
|
|
EOF
|
|
|
|
|
2020-03-17 09:18:13 +01:00
|
|
|
COPY image.d
|
2019-11-15 18:00:26 +01:00
|
|
|
|
|
|
|
RUN EOF
|
|
|
|
# Install gems required by decidim
|
|
|
|
cd /srv/decidim-app
|
2020-04-04 00:17:24 +02:00
|
|
|
bundle update
|
2019-11-15 18:00:26 +01:00
|
|
|
|
|
|
|
# Setup delayed job for mail sending
|
|
|
|
bin/rails generate delayed_job:active_record
|
|
|
|
|
|
|
|
# Precompile static assets
|
|
|
|
bin/rails assets:precompile
|
|
|
|
|
|
|
|
# Change ownership
|
2019-11-23 18:11:18 +01:00
|
|
|
chown -R decidim:decidim /srv/decidim-app
|
2019-11-15 18:00:26 +01:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
apk --no-cache del .deps
|
2019-11-23 18:11:18 +01:00
|
|
|
rm -rf /tmp/*
|
2020-03-25 21:32:19 +01:00
|
|
|
rm -rf /.bundle /root/.gem
|
2019-11-15 18:00:26 +01:00
|
|
|
EOF
|
|
|
|
|
2020-02-09 15:54:46 +01:00
|
|
|
CMD /bin/s6-svscan /etc/services.d
|