Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 80 additions & 67 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ SHELL ["/bin/bash", "-c"]
USER root

ARG BUILD_PACKAGES="git libicu-dev libpq-dev ca-certificates curl gnupg"
ARG BUILD_SCRIPT="set -uex \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo \"deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main\" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install nodejs -y \
&& npm install -g yarn \
&& yarn set version 1.22.19 \
ARG BUILD_SCRIPT=" \
set -uex \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo \"deb [signed-by=/etc/apt/keyrings/nodesource.gpg] \
https://deb.nodesource.com/node_18.x nodistro main\" \
> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install nodejs -y \
&& npm install -g yarn \
&& yarn set version 1.22.19 \
"
ARG BUNDLE_WITHOUT="development:metrics:test"
ARG BUNDLER_VERSION="2.5.23"
Expand All @@ -34,20 +38,25 @@ ARG CUSTOMIZATION_OUTPUT="false"
ARG DEFACE_ENABLED="0"

# Install packages needed at buildtime
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y ${BUILD_PACKAGES}
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y ${BUILD_PACKAGES}

# Installs nodejs as a dependency
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg -o /root/yarn-pubkey.gpg && apt-key add /root/yarn-pubkey.gpg \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ && apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
nodejs \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg \
-o /root/yarn-pubkey.gpg \
&& apt-key add /root/yarn-pubkey.gpg \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" \
> /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -yq --no-install-recommends \
nodejs \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log

RUN [[ ${BUILD_SCRIPT} ]] && bash -c "${BUILD_SCRIPT}"

Expand All @@ -61,15 +70,16 @@ COPY ./Gemfile ./Gemfile.lock /app-src/
WORKDIR /app-src

# Run deployment
RUN gem update --system \
&& bundle config set --local deployment 'true' \
&& bundle config set --local without ${BUNDLE_WITHOUT} \
&& bundle package \
&& bundle install \
&& bundle clean
RUN gem update --system \
&& bundle config set --local deployment 'true' \
&& bundle config set --local without ${BUNDLE_WITHOUT} \
&& bundle package \
&& bundle install \
&& bundle clean

COPY ./package.json /app-src/
RUN npm install
COPY ./package.json ./yarn.lock /app-src/
COPY ./packages /app-src/packages
RUN yarn

# set up app-src directory
COPY . /app-src
Expand Down Expand Up @@ -101,49 +111,52 @@ ARG CUSTOMIZATION_OUTPUT="false"
ENV TZ="Europe/Zurich"

# Prepare apt-get
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get upgrade -y \
# Install libpaper1 seperately, because statx is broken on APPUiO build
&& apt-get install -y ucf \
&& apt-get download libpaper1 \
&& dpkg --unpack libpaper1*.deb \
&& rm /var/lib/dpkg/info/libpaper1\:amd64.postinst \
&& dpkg --configure libpaper1 \
&& apt-get install -yf \
&& rm libpaper1*.deb \
# Install the Packages we need at runtime
&& apt-get -y install ${RUN_PACKAGES} \
vim-tiny curl \
# HACK: Maybe move to different image... gives clamav the right to execute
&& usermod -a -G 0 clamav \
# Clean up after ourselves
&& unset DEBIAN_FRONTEND
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get upgrade -y \
# Install libpaper1 seperately, because statx is broken on APPUiO build
&& apt-get install -y ucf \
&& apt-get download libpaper1 \
&& dpkg --unpack libpaper1*.deb \
&& rm /var/lib/dpkg/info/libpaper1\:amd64.postinst \
&& dpkg --configure libpaper1 \
&& apt-get install -yf \
&& rm libpaper1*.deb \
# Install the Packages we need at runtime
&& apt-get -y install ${RUN_PACKAGES} \
neovim curl \
# HACK: Maybe move to different image... gives clamav the right to execute
&& usermod -a -G 0 clamav \
# Clean up after ourselves
&& unset DEBIAN_FRONTEND

# Copy deployment ready source code from build
COPY --from=build /app-src /app-src
COPY docker/ /
WORKDIR /app-src

RUN chgrp -R 0 /app-src \
&& chmod -R u+w,g=u /app-src
RUN chgrp -R 0 /app-src \
&& chmod -R u+w,g=u /app-src
# HACK: Maybe move to different image... Set group permissions to app folder and help clamav to start
RUN mkdir /var/run/clamav \
&& chown clamav /run/clamav \
&& sed -i 's/^chown/# chown/' /etc/init.d/clamav-daemon \
&& chgrp -R 0 /app-src \
/var/log/clamav \
/var/lib/clamav \
/var/run/clamav \
/run/clamav \
&& chmod -R u+w,g=u /app-src \
/var/log/clamav \
/var/lib/clamav \
/var/run/clamav \
/run/clamav \
/run/clamav \
/opt/bin/start_clamd \
&& freshclam
RUN mkdir /var/run/clamav \
&& chown clamav /run/clamav \
&& sed -i 's/^chown/# chown/' /etc/init.d/clamav-daemon \
&& chgrp -R 0 \
/app-src \
/var/log/clamav \
/var/lib/clamav \
/var/run/clamav \
/run/clamav \
&& chmod -R \
u+w,g=u \
/app-src \
/var/log/clamav \
/var/lib/clamav \
/var/run/clamav \
/run/clamav \
/run/clamav \
/opt/bin/start_clamd \
&& freshclam

ENV HOME=/app-src

Expand All @@ -152,10 +165,10 @@ RUN gem install bundler:${BUNDLER_VERSION} --no-document

# Use cached gems

RUN gem update --system \
&& bundle config set --local deployment 'true' \
&& bundle config set --local without ${BUNDLE_WITHOUT} \
&& bundle
RUN gem update --system \
&& bundle config set --local deployment 'true' \
&& bundle config set --local without ${BUNDLE_WITHOUT} \
&& bundle

USER 1001

Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ruby RUBY_VERSION

gem 'execjs' # , '= 2.7.0'

gem "decidim", github: "openpoke/decidim", branch: "0.29-backports"
gem 'decidim', github: 'openpoke/decidim', branch: '0.29-backports'
gem 'decidim-proposals', DECIDIM_VERSION
# gem 'decidim-consultations', DECIDIM_VERSION
# gem 'decidim-initiatives', DECIDIM_VERSION
Expand All @@ -18,7 +18,7 @@ gem 'decidim-templates', DECIDIM_VERSION
gem 'decidim-anonymous_codes', github: 'openpoke/decidim-module-anonymous_codes'

# anonymous_proposals tries to deface overwrite a view that no longer exists, this kills the docker build
# gem 'decidim-anonymous_proposals', github: 'PopulateTools/decidim-module-anonymous_proposals', tag: 'v0.28.0'
gem 'decidim-anonymous_proposals', github: 'openpoke/decidim-module-anonymous_proposals', branch: 'main'
gem 'decidim-antivirus', github: 'puzzle/decidim-module-antivirus', branch: 'master'
gem 'decidim-decidim_awesome', github: 'decidim-ice/decidim-module-decidim_awesome', branch: 'main'
gem 'decidim-decidim_geo', git: 'https://git.octree.ch/decidim/decidim-module-geo.git'
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ GIT
decidim-surveys (>= 0.29.0, < 0.30)
deface (>= 1.9.0)

GIT
remote: https://github.com/openpoke/decidim-module-anonymous_proposals.git
revision: 54aa291751760345a382bd455530393bca4964ce
branch: main
specs:
decidim-anonymous_proposals (0.29)
decidim-core (>= 0.29)
deface (~> 1.9)

GIT
remote: https://github.com/openpoke/decidim-module-participatory-documents.git
revision: 9c632e086d0e0328ad28f3fb1370bc239439be66
Expand Down Expand Up @@ -1088,6 +1097,7 @@ DEPENDENCIES
dalli
decidim!
decidim-anonymous_codes!
decidim-anonymous_proposals!
decidim-antivirus!
decidim-conferences (= 0.29.4)
decidim-decidim_awesome!
Expand Down
Loading