Top Menu

Jump to content
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    Home
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      OpenProject ID Google

Side Menu

Collapse project menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Expand project menu
Plugins
  1. OpenProject Community
  2. OpenProject
  3. Forums
  4. Plugins
  5. Docker build with plugin doesn't seem to work

Docker build with plugin doesn't seem to work

Added by Eduard Liebenberger 13 days ago

Hi team,

We're trying to create our custom Docker image for OpenProject to get our own plugin up and running. We've been following these instructions: https://www.openproject.org/docs/installation-and-operations/installation/docker/#openproject-plugins

This is our Dockerfile:

FROM openproject/openproject:16 AS plugin

# If installing a local plugin (using `path:` in the `Gemfile.plugins` above),
# you will have to copy the plugin code into the container here and use the
# path inside of the container. Say for `/app/vendor/plugins/openproject-slack`:
# COPY /path/to/my/local/openproject-slack /app/vendor/plugins/openproject-slack

COPY Gemfile.plugins /app/
COPY plugins/openproject-pathways /app/plugins/openproject-pathways

# If the plugin uses any external NPM dependencies you have to install them here.
# RUN npm add npm <package-name>*

RUN bundle config unset deployment && bundle install && bundle config set deployment 'true'
RUN rm -f config/frontend_assets.manifest.json
RUN ./docker/prod/setup/precompile-assets.sh

FROM openproject/openproject:16-slim

COPY --from=plugin /usr/bin/git /usr/bin/git
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/vendor/bundle /app/vendor/bundle
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/plugins /app/plugins
COPY --chown=$APP_USER:$APP_USER --from=plugin /usr/local/bundle /usr/local/bundle
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/public/assets /app/public/assets
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/config/frontend_assets.manifest.json /app/config/frontend_assets.manifest.json
COPY --chown=$APP_USER:$APP_USER --from=plugin /app/Gemfile.* /app/

Initially this looks like it's working - however it doesn't actually build our plugin in correctly. We have a frontend component that needs to be linked into the core frontend, and looking at ./docker/prod/setup/precompile-assets.sh it is skipping the linking because the frontend assets (of the core) already exists. That's why we added  RUN rm -f config/frontend_assets.manifest.json above to force the linking. And then the Docker build fails, seemingly because there is no valid database connection (which is reasonable at build time).

43.14 + SECRET_KEY_BASE=1
43.14 + RAILS_ENV=production
43.14 + DATABASE_URL=nulldb://db
43.14 + bin/rails openproject:plugins:register_frontend assets:precompile
48.49 bin/rails aborted!
48.50 ArgumentError: undefined class/module ActiveRecord::ConnectionAdapters::PostgreSQL:: (ArgumentError)

Any ideas how we get around that without a database connection (this Docker build usually runs in our Github workflows)?


Replies (1)

RE: Docker build with plugin doesn't seem to work - Added by Eduard Liebenberger 9 days ago

Just for anybody else encountering this. We ended up creating a Dockerfile with a Ruby base image and reproduced the official Dockerfile (within OP Core) - effectively building OpenProject from source but with our plugins baked in. Still messy but at least it's working

  • (1 - 1/1)
Loading...