OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Backport docker build to 14.0
Oliver Günther3e11521dda9d
diff --git a/.dockerignore b/.dockerignoreindex bca449c8d7c..9a5efd58414 100644--- a/.dockerignore+++ b/.dockerignore@@ -33,3 +33,6 @@ frontend/node_modulesnode_modules# travisvendor/bundle+# allow precompiled assets to be injected+!/public/assets+!/config/frontend_assets.manifest.jsondiff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymlindex b1165957faa..8f586644447 100644--- a/.github/workflows/docker.yml+++ b/.github/workflows/docker.yml@@ -3,7 +3,7 @@ name: Dockeron:# build dev dailyschedule:- - cron: '20 2 * * *' # Daily at 02:20+ - cron: "20 2 * * *" # Daily at 02:20push:tags:@@ -21,7 +21,7 @@ env:REGISTRY_IMAGE: openproject/openprojectjobs:- extract_version:+ setup:runs-on: ubuntu-lateststeps:- name: Extract version@@ -36,6 +36,11 @@ jobs:elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; thenTAG_REF=${{ inputs.tag }}CHECKOUT_REF=${{ inputs.tag }}++ if [ -z "$TAG_REF" ]; then+ TAG_REF=dev+ CHECKOUT_REF=dev+ fielseecho "Unsupported event"exit 1@@ -50,75 +55,105 @@ jobs:echo "Version: $VERSION"echo "version=$VERSION" >> "$GITHUB_OUTPUT"echo "checkout_ref=$CHECKOUT_REF" >> "$GITHUB_OUTPUT"+ - uses: actions/checkout@v4+ - name: Cache NPM+ uses: runs-on/cache@v4+ with:+ path: |+ frontend/node_modules+ node_modules+ key: nodejs-x64-${{ hashFiles('**/package-lock.json') }}+ restore-keys: nodejs-x64-+ - name: Cache angular+ uses: runs-on/cache@v4+ with:+ path: frontend/.angular+ key: angular-${{ github.ref }}+ restore-keys: angular-+ - uses: ruby/setup-ruby@v1+ with:+ bundler-cache: true+ - uses: actions/setup-node@v4+ with:+ node-version: 20+ cache: npm+ cache-dependency-path: |+ package-lock.json+ frontend/package-lock.json+ - name: Precompile assets+ run: |+ ./docker/prod/setup/precompile-assets.sh+ cp config/frontend_assets.manifest.json public/assets/frontend_assets.manifest.json+ - uses: actions/upload-artifact@v3+ with:+ path: public/+ name: public-assets-${{ github.sha }}outputs:version: ${{ steps.extract_version.outputs.version }}checkout_ref: ${{ steps.extract_version.outputs.checkout_ref }}build:needs:- - extract_version+ - setupif: github.repository == 'opf/openproject'- runs-on: runs-on,runner=8cpu-linux,family=m7i+m7a,run-id=${{ github.run_id }}+ runs-on:+ labels:+ - runs-on+ - ssh=false+ - run-id=${{ github.run_id }}+ - ${{ matrix.runner }}strategy:matrix:include:- platform: linux/amd64+ bim_support: truetarget: slim+ runner: runner=4cpu-linux-x64- platform: linux/arm64/v8+ bim_support: falsetarget: slim+ runner: runner=4cpu-linux-arm64- platform: linux/amd64+ bim_support: truetarget: all-in-one- - platform: linux/ppc64le+ runner: runner=4cpu-linux-x64+ - platform: linux/arm64/v8bim_support: falsetarget: all-in-one- - platform: linux/arm64/v8+ runner: runner=4cpu-linux-arm64+ - platform: linux/ppc64lebim_support: falsetarget: all-in-one+ runner: runner=4cpu-linux-x64steps:- - name: Extract version- id: extract_version- run: |- if [[ ${{ github.event_name }} == 'push' ]]; then- TAG_REF=${GITHUB_REF#refs/tags/}- CHECKOUT_REF=$GITHUB_REF- elif [[ ${{ github.event_name }} == 'schedule' ]]; then- TAG_REF=dev- CHECKOUT_REF=refs/heads/dev- elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then- TAG_REF=${{ inputs.tag }}- CHECKOUT_REF=${{ inputs.tag }}- else- echo "Unsupported event"- exit 1- fi-- if [ -z "$TAG_REF" ] || [ -z "$CHECKOUT_REF" ]; then- echo "No TAG_REF or CHECKOUT_REF set. Aborting"- exit 1- fi-- VERSION=${TAG_REF#v}- echo "Version: $VERSION"- echo "::set-output name=version::$VERSION"- echo "::set-output name=checkout_ref::$CHECKOUT_REF"- name: Checkoutwith:- ref: ${{ steps.extract_version.outputs.checkout_ref }}+ ref: ${{ needs.setup.outputs.checkout_ref }}uses: actions/checkout@v4- name: Prepare docker filesrun: |cp ./docker/prod/Dockerfile ./Dockerfile-- # Add build information- echo "${{ steps.extract_version.outputs.checkout_ref }}" > PRODUCT_VERSION- echo "https://github.com/opf/openproject/commits/${{ steps.extract_version.outputs.checkout_ref }}" > PRODUCT_URL+ - name: Download precompiled public assets+ uses: actions/download-artifact@v3+ with:+ name: public-assets-${{ github.sha }}+ path: public/+ - name: Setup precompiled assets+ run: |+ ls -al public/+ mv public/assets/frontend_assets.manifest.json config/frontend_assets.manifest.json+ ls -al config/frontend_assets.manifest.json+ - name: Add build information+ run: |+ echo "${{ needs.setup.outputs.checkout_ref }}" > PRODUCT_VERSION+ echo "https://github.com/opf/openproject/commits/${{ needs.setup.outputs.checkout_ref }}" > PRODUCT_URLdate -u +"%Y-%m-%dT%H:%M:%SZ" > RELEASE_DATE- name: Set up QEMU- uses: docker/setup-qemu-action@v2+ uses: docker/setup-qemu-action@v3- name: Set up Docker Buildxid: buildx- uses: docker/setup-buildx-action@v2+ uses: docker/setup-buildx-action@v3- name: Login to Docker Hub- uses: docker/login-action@v2+ uses: docker/login-action@v3with:username: ${{ secrets.DOCKER_USERNAME }}password: ${{ secrets.DOCKER_PASSWORD }}@@ -132,7 +167,7 @@ jobs:org.opencontainers.image.documentation=https://www.openproject.org/docs/org.opencontainers.image.vendor=OpenProject GmbHtags: |- type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }}+ type=semver,pattern={{version}},value=${{ needs.setup.outputs.version }}images: |${{ env.REGISTRY_IMAGE }}- name: Build image@@ -148,6 +183,8 @@ jobs:load: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}+ cache-from: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }}+ cache-to: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }},mode=max- name: Test# We only test the native container. If that fails the builds for the others# will be cancelled as well.@@ -176,6 +213,8 @@ jobs:BIM_SUPPORT=${{ matrix.bim_support }}labels: ${{ steps.meta.outputs.labels }}outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true+ cache-from: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }}+ cache-to: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }},mode=max- name: Export digestrun: |mkdir -p /tmp/digests@@ -194,7 +233,7 @@ jobs:matrix:target: [slim, all-in-one]needs:- - extract_version+ - setup- buildsteps:- name: Download digests@@ -209,7 +248,7 @@ jobs:if [ "$suffix" = "-all-in-one" ]; then suffix="" ; fiecho "suffix=$suffix" >> "$GITHUB_OUTPUT"- name: Set up Docker Buildx- uses: docker/setup-buildx-action@v2+ uses: docker/setup-buildx-action@v3- name: Docker metaid: metauses: docker/metadata-action@v4@@ -223,12 +262,12 @@ jobs:latest=falsesuffix=${{ steps.set_suffix.outputs.suffix }}tags: |- type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }}- type=semver,pattern={{major}}.{{minor}},value=${{ needs.extract_version.outputs.version }}- type=semver,pattern={{major}},value=${{ needs.extract_version.outputs.version }}+ type=semver,pattern={{version}},value=${{ needs.setup.outputs.version }}+ type=semver,pattern={{major}}.{{minor}},value=${{ needs.setup.outputs.version }}+ type=semver,pattern={{major}},value=${{ needs.setup.outputs.version }}type=raw,value=dev,priority=200,enable={{is_default_branch}}- name: Login to Docker Hub- uses: docker/login-action@v2+ uses: docker/login-action@v3with:username: ${{ secrets.DOCKER_USERNAME }}password: ${{ secrets.DOCKER_PASSWORD }}@@ -240,3 +279,11 @@ jobs:- name: Inspect imagerun: |docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}+ notify:+ needs: [setup, build, merge]+ if: ${{ always() && contains(needs.*.result, 'failure') }}+ uses: ./.github/workflows/email-notification.yml+ secrets: inherit+ with:+ subject: "Docker build failed"+ body: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfileindex 1aa8df4d9d3..5f97285464c 100644--- a/docker/prod/Dockerfile+++ b/docker/prod/Dockerfile@@ -1,73 +1,17 @@ARG RUBY_VERSION="3.2.3"-ARG NODE_VERSION="20.9.0"-ARG BUNDLER_VERSION="2.5.5"-ARG DEBIAN_FRONTEND=noninteractive+FROM ruby:${RUBY_VERSION}-bullseye as base+LABEL maintainer="[email protected]"-# --------------------------------------# rubygems (private)-# --------------------------------------FROM ruby:${RUBY_VERSION}-bullseye as rubygems+ARG BUNDLER_VERSION="2.5.10"+ARG NODE_VERSION="20.9.0"+ARG BIM_SUPPORT=true+ENV DEBIAN_FRONTEND=noninteractiveENV BUNDLE_JOBS=8ENV BUNDLE_RETRY=3ENV BUNDLE_WITHOUT="development:test"-WORKDIR /app--RUN gem install bundler --version "$BUNDLER_VERSION" --no-document--COPY Gemfile Gemfile.modules Gemfile.lock .ruby-version ./-COPY modules ./modules-RUN bundle install--# --------------------------------------# nodejs (private)-# --------------------------------------# Using docker image for node so that multi-arch is automatically taken care of-FROM node:${NODE_VERSION} as nodejs--WORKDIR /app--COPY package.json ./-COPY frontend/package.json frontend/package-lock.json frontend/.npmrc ./frontend/-RUN JOBS=8 npm install--# --------------------------------------# assets (private)-# --------------------------------------FROM rubygems as assets--COPY --from=nodejs /usr/local/bin/node /usr/local/bin/node-COPY --from=nodejs /usr/local/lib/node_modules /usr/local/lib/node_modules-COPY --from=nodejs /usr/local/include/node /usr/local/include/node-RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm--WORKDIR /app--COPY --from=nodejs /app/node_modules ./node_modules-COPY --from=nodejs /app/frontend/node_modules ./frontend/node_modules-COPY Rakefile .-COPY bin ./bin-COPY app ./app-COPY config ./config-COPY config/database.production.yml ./config/database.yml-COPY lib ./lib-COPY lib_static ./lib_static-COPY frontend ./frontend-COPY modules ./modules-COPY vendor ./vendor-COPY lookbook ./lookbook--RUN --mount=type=cache,target=/app/frontend/.angular/cache,uid=1000,gid=1000 \- SECRET_KEY_BASE=1 RAILS_ENV=production DATABASE_URL=nulldb://db \- bin/rails openproject:plugins:register_frontend assets:precompile--# --------------------------------------# base (private)-# --------------------------------------FROM ruby:${RUBY_VERSION}-slim-bullseye as base-LABEL maintainer="[email protected]"-# SYSTEM+ENV DOCKER=1ENV APP_USER=appENV APP_PATH=/appENV APP_DATA_PATH=/var/openproject/assets@@ -90,6 +34,7 @@ ENV OPENPROJECT_EDITION=standardENV OPENPROJECT_INSTALLATION__TYPE=dockerENV OPENPROJECT_ATTACHMENTS__STORAGE__PATH=$APP_DATA_PATH/filesENV OPENPROJECT_RAILS__CACHE__STORE=file_store+ENV OPENPROJECT_ANGULAR_UGLIFY=trueRUN useradd -d /home/$APP_USER -m $APP_USERRUN mkdir -p $APP_PATH && chown $APP_USER:$APP_USER $APP_PATH@@ -97,47 +42,52 @@ RUN mkdir -p $APP_DATA_PATH && chown $APP_USER:$APP_USER $APP_DATA_PATH && chmodWORKDIR $APP_PATH-RUN --mount=type=cache,target=/var/cache/apt \- apt-get update -qq \- && apt-get install -yq --no-install-recommends \- file \- curl \- gnupg2 \- && curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \- && echo 'deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main' > /etc/apt/sources.list.d/pgdg.list \- && apt-get update -qq \- && apt-get install -yq --no-install-recommends \- libpq5 \- postgresql-client-$CURRENT_PGVERSION \- postgresql-client-$NEXT_PGVERSION \- libffi7 \- unrtf tesseract-ocr poppler-utils catdoc imagemagick \- && apt-get purge -y curl gnupg2 \- && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \- && truncate -s 0 /var/log/*log+# upgrade bundler+RUN gem install bundler --version "$BUNDLER_VERSION" --no-document-# --------------------------------------# slim (public)-# --------------------------------------FROM base as slim-COPY --chown=$APP_USER:$APP_USER --from=rubygems /usr/local/bundle /usr/local/bundle-COPY --chown=$APP_USER:$APP_USER --from=assets /app/public/assets /app/public/assets-COPY --chown=$APP_USER:$APP_USER --from=assets /app/config/frontend_assets.manifest.json /app/config/frontend_assets.manifest.json-COPY --chown=$APP_USER:$APP_USER . .-COPY --chown=$APP_USER:$APP_USER ./config/database.production.yml /app/config/database.yml-# Update Gemfile.lock in case a plugin has been added. It it hasn't, the file stays identical.-COPY --chown=$APP_USER:$APP_USER --from=rubygems /app/Gemfile.lock /app/+# system dependencies, nodejs+COPY ./docker/prod/setup/preinstall-common.sh ./docker/prod/setup/preinstall-common.sh+RUN ./docker/prod/setup/preinstall-common.sh++# stuff required for gems+COPY Gemfile Gemfile.* .ruby-version ./+COPY modules ./modules+COPY vendor ./vendor+# some gemspec files of plugins require files in there, notably OpenProject::Version+COPY lib ./lib++RUN \+ bundle config set --local path 'vendor/bundle' && \+ bundle config set --local without 'test development' && \+ bundle install --quiet --no-cache --jobs=8 --retry=3 && \+ bundle config set deployment 'true' && \+ cp Gemfile.lock Gemfile.lock.bak && \+ rm -rf vendor/bundle/ruby/*/cache && \+ rm -rf vendor/bundle/ruby/*/gems/*/spec && \+ rm -rf vendor/bundle/ruby/*/gems/*/test-ENV BUNDLE_FROZEN=true+COPY . .++# Copy lock file again as the updated version was overriden by COPY just now+RUN cp Gemfile.lock.bak Gemfile.lock && rm Gemfile.lock.bak++RUN ./docker/prod/setup/precompile-assets.sh+RUN ./docker/prod/setup/postinstall-common.sh# We need this so puma is allowed to create the tmp/pids folder and# temporary upload files when running with a uid other than 1000 (app)# but with an allowed supplemental group (1000).RUN tmp_path=$APP_PATH/tmp; (mkdir -p $tmp_path || true) && chown $APP_USER:$APP_USER $tmp_path && chmod g+rw $tmp_path-USER $APP_USER+RUN cp ./config/database.production.yml config/database.ymlRUN ln -s $APP_PATH/docker/prod/setup/.irbrc /home/$APP_USER/+# -------------------------------------+# slim (public)+# -------------------------------------+FROM base as slim++USER $APP_USEREXPOSE 8080CMD ["./docker/prod/web"]VOLUME ["$APP_DATA_PATH"]@@ -146,61 +96,16 @@ VOLUME ["$APP_DATA_PATH"]# all-in-one (public)# -------------------------------------FROM base as all-in-one-ARG DEBIAN_FRONTEND-ARG NODE_VERSION-ARG BUNDLER_VERSION-# Allow platform-specific additions. Valid values are: on-prem,saas,bahn-ARG PLATFORM=on-prem-# Use OAuth token in case private gems need to be fetched-ARG GITHUB_OAUTH_TOKEN-ARG BIM_SUPPORT=true-ARG GOSU_VERSION="1.17"-ARG OPENPROJECT_ANGULAR_UGLIFY=trueENV OPENPROJECT_RAILS__CACHE__STORE=memcacheENV DATABASE_URL=postgres://openproject:[email protected]/openprojectENV PGDATA=/var/openproject/pgdata-ENV PGBIN="/usr/lib/postgresql/$PGVERSION/bin"--COPY docker/prod/setup ./docker/prod/setup-RUN ./docker/prod/setup/preinstall.sh+ARG GOSU_VERSION="1.17"-RUN dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \- && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \- && chmod +x /usr/local/bin/gosu \- && gosu nobody true+RUN ./docker/prod/setup/postinstall-onprem.sh-# set irb default config for app (docker run -it ...) and root (docker exec -it ...) users-RUN ln -s /app/docker/prod/setup/.irbrc /home/$APP_USER/RUN ln -s /app/docker/prod/setup/.irbrc /root/-COPY Gemfile Gemfile.* .ruby-version ./-COPY modules ./modules-COPY vendor ./vendor-# some gemspec files of plugins require files in there, notably OpenProject::Version-COPY lib ./lib--RUN \- bundle config set --local path 'vendor/bundle' && \- bundle config set --local without 'test development' && \- bundle install --quiet --no-cache --jobs=8 --retry=3 && \- bundle config set deployment 'true' && \- cp Gemfile.lock Gemfile.lock.bak && \- rm -rf vendor/bundle/ruby/*/cache && \- rm -rf vendor/bundle/ruby/*/gems/*/spec && \- rm -rf vendor/bundle/ruby/*/gems/*/test--# Finally, copy over the whole thing-COPY . .--# Copy lock file again as the updated version was overriden by COPY just now-RUN cp Gemfile.lock.bak Gemfile.lock && rm Gemfile.lock.bak--RUN ./docker/prod/setup/postinstall.sh--# this has to happen after postinstall.sh since it uses a different database.yml-COPY config/database.production.yml ./config/database.yml-# Expose ports for apache and postgresEXPOSE 80 5432diff --git a/docker/prod/setup/postinstall-common.sh b/docker/prod/setup/postinstall-common.shindex ead33f2ff9c..3da98edb802 100755--- a/docker/prod/setup/postinstall-common.sh+++ b/docker/prod/setup/postinstall-common.sh@@ -1,50 +1,8 @@#!/bin/bash+set -eox pipefail-set -e-set -o pipefail+# Ensure we can write in /tmp/op_uploaded_files (cf. #29112)+mkdir -p /tmp/op_uploaded_files/ && chown -R $APP_USER:$APP_USER /tmp/op_uploaded_files/-pushd "${APP_PATH}/frontend"--export NG_CLI_ANALYTICS=ci # so angular cli doesn't block waiting for user input--# Installing frontend dependencies-npm install--popd--# Bundle assets--su - postgres -c "$PGBIN/initdb -D /tmp/nulldb"-su - postgres -c "$PGBIN/pg_ctl -D /tmp/nulldb -l /dev/null -l /tmp/nulldb/log -w start"--# give some more time for DB to start-sleep 5--echo "create database assets; create user assets with encrypted password 'p4ssw0rd'; grant all privileges on database assets to assets;" | su - postgres -c psql--# dump schema-DATABASE_URL=postgres://assets:[email protected]/assets RAILS_ENV=production bundle exec rake db:migrate db:schema:dump db:schema:cache:dump--# this line requires superuser rights, which is not always available and doesn't matter anyway-sed -i '/^COMMENT ON EXTENSION/d' db/structure.sql--# precompile assets-DATABASE_URL=postgres://assets:[email protected]/assets RAILS_ENV=production bundle exec rake assets:precompile--su - postgres -c "$PGBIN/pg_ctl -D /tmp/nulldb stop"--rm -rf /tmp/nulldb--# Remove sprockets cache-rm -rf "$APP_PATH/tmp/cache/assets"--# Remove node_modules and entire frontend-rm -rf "$APP_PATH/node_modules/" "$APP_PATH/frontend/node_modules/"--# Remove angular cache-rm -rf "$APP_PATH/frontend/.angular"--# Clean cache in root-rm -rf /root/.npm--rm -f "$APP_PATH/log/production.log"+# Remove any existing config/database.yml+rm -f ./config/database.yml\ No newline at end of filediff --git a/docker/prod/setup/postinstall-onprem.sh b/docker/prod/setup/postinstall-onprem.shnew file mode 100755index 00000000000..ec4160ce7bd--- /dev/null+++ b/docker/prod/setup/postinstall-onprem.sh@@ -0,0 +1,43 @@+#!/bin/bash+set -eox pipefail+++# postfix.postinst tries to generate a hostname based on /etc/resolv.conf, which+# gets copied in to the docker environment from the host system. On systems+# that are not on a network with a domain, this will result in a failed install.+#+# See https://salsa.debian.org/postfix-team/postfix-dev/-/blob/debian/buster-updates/debian/postfix.postinst#L40+if [ -f /run/.containerenv -o -f /.dockerenv ]; then+ mv /bin/hostname /bin/x-hostname+ echo openproject.local > /etc/hostname+ apt-get install -y postfix+ mv /bin/x-hostname /bin/hostname+fi++apt-get update -qq+# embed all-in-one additional software+apt-get install -y \+ postgresql-$CURRENT_PGVERSION \+ postgresql-$NEXT_PGVERSION \+ memcached \+ postfix \+ apache2 \+ supervisor \+ git subversion \+ wget++# remove any existing cluster+service postgresql stop+rm -rf /var/lib/postgresql/{$CURRENT_PGVERSION,$NEXT_PGVERSION}++a2enmod proxy proxy_http+rm -f /etc/apache2/sites-enabled/000-default.conf++# gosu+dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"+wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"+chmod +x /usr/local/bin/gosu+gosu nobody true++rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*+truncate -s 0 /var/log/*logdiff --git a/docker/prod/setup/precompile-assets.sh b/docker/prod/setup/precompile-assets.shnew file mode 100755index 00000000000..663b32b6103--- /dev/null+++ b/docker/prod/setup/precompile-assets.sh@@ -0,0 +1,25 @@+#!/bin/bash+set -exo pipefail++if [ -f config/frontend_assets.manifest.json ]; then+ echo "Assets have already been precompiled. Reusing."+else+ echo "Assets need to be compiled"+ JOBS=8 npm install++ SECRET_KEY_BASE=1 RAILS_ENV=production DATABASE_URL=nulldb://db \+ bin/rails openproject:plugins:register_frontend assets:precompile++ if [ "$DOCKER" = "1" ]; then+ rm -rf /tmp/nulldb+ # Remove sprockets cache+ rm -rf "$APP_PATH/tmp/cache/assets"+ # Remove node_modules and entire frontend+ rm -rf "$APP_PATH/node_modules/" "$APP_PATH/frontend/node_modules/"+ # Remove angular cache+ rm -rf "$APP_PATH/frontend/.angular"+ # Clean cache in root+ rm -rf /root/.npm+ rm -f "$APP_PATH/log/production.log"+ fi+fi\ No newline at end of filediff --git a/docker/prod/setup/preinstall-common.sh b/docker/prod/setup/preinstall-common.shindex 3a9b092d43f..ee5569141d3 100755--- a/docker/prod/setup/preinstall-common.sh+++ b/docker/prod/setup/preinstall-common.sh@@ -19,51 +19,56 @@ get_architecture() {return 0}-set -e-set -o pipefail+set -exo pipefailARCHITECTURE=$(get_architecture)apt-get update -qq-apt-get install -y git subversion wget curl gnupg2 apt-transport-https unzip build-essential libpq-dev libclang-dev+# make sure all dependencies are up to date+apt-get upgrade -y++apt-get install -yq --no-install-recommends \+ file \+ curl \+ gnupg2 \# install node + npmcurl -s https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCHITECTURE}.tar.gz | tar xzf - -C /usr/local --strip-components=1-wget --quiet -O- https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add --echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list--if [ ! "$BIM_SUPPORT" = "false" ]; then- # https://learn.microsoft.com/en-gb/dotnet/core/install/linux-debian#debian-11- wget --quiet https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O /tmp/packages-microsoft-prod.deb && \- dpkg -i /tmp/packages-microsoft-prod.deb && rm /tmp/packages-microsoft-prod.deb-fi+curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -+echo 'deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main' > /etc/apt/sources.list.d/pgdg.listapt-get update -qq-apt-get install -y \- poppler-utils \+apt-get install -yq --no-install-recommends \+ libpq-dev \+ postgresql-client-$CURRENT_PGVERSION \+ postgresql-client-$NEXT_PGVERSION \+ libpq5 \+ libffi7 \unrtf \tesseract-ocr \+ poppler-utils \catdoc \- postgresql-9.6 \- postgresql-client-9.6 \- postgresql-13 \- postgresql-client-13 \imagemagick \- memcached+ libclang-dev-# remove any existing cluster-service postgresql stop-rm -rf /var/lib/postgresql/{9.6,13}# Specifics for BIM editionif [ ! "$BIM_SUPPORT" = "false" ]; then+ apt-get install -y wget unzip++ # https://learn.microsoft.com/en-gb/dotnet/core/install/linux-debian#debian-11+ wget --quiet https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O /tmp/packages-microsoft-prod.deb+ dpkg -i /tmp/packages-microsoft-prod.deb+ rm /tmp/packages-microsoft-prod.deb++ apt-get update -qqapt-get install -y dotnet-runtime-6.0 # required for BIM editiontmpdir=$(mktemp -d)cd $tmpdir# Install XKT converter- npm install @xeokit/[email protected] -g+ npm install -g @xeokit/[email protected]# Install COLLADA2GLTFwget --quiet https://github.com/KhronosGroup/COLLADA2GLTF/releases/download/v2.1.5/COLLADA2GLTF-v2.1.5-linux.zip@@ -85,6 +90,8 @@ if [ ! "$BIM_SUPPORT" = "false" ]; thenrm -rf $tmpdirfi-gem install bundler --version "$BUNDLER_VERSION" --no-document-id $APP_USER || useradd -d /home/$APP_USER -m $APP_USER++rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*+truncate -s 0 /var/log/*log+