OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/Dockerfile

69 lines
2.4 KiB

FROM ruby:2.5-stretch
9 years ago
ENV NODE_VERSION="8.11.1"
ENV BUNDLER_VERSION="1.16.2"
ENV APP_USER app
ENV APP_PATH /usr/src/app
ENV APP_DATA /var/db/openproject
ENV ATTACHMENTS_STORAGE_PATH /var/db/openproject/files
9 years ago
# install node + npm
RUN curl https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz | tar xzf - -C /usr/local --strip-components=1
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
postgresql-client \
mysql-client \
sqlite \
poppler-utils \
unrtf \
tesseract-ocr \
catdoc && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# using /home/app since npm cache and other stuff will be put there when running npm install
# we don't want to pollute any locally-mounted directory
RUN useradd -d /home/$APP_USER -m $APP_USER
RUN mkdir -p $APP_PATH $APP_DATA
RUN gem install bundler --version "${bundler_version}"
9 years ago
WORKDIR $APP_PATH
9 years ago
COPY Gemfile ./Gemfile
COPY Gemfile.* ./
6 years ago
COPY modules ./modules
# OpenProject::Version is required by module versions in gemspecs
RUN mkdir -p lib/open_project
COPY lib/open_project/version.rb ./lib/open_project/
6 years ago
RUN bundle install --deployment --with="docker opf_plugins" --without="test development" --jobs=8 --retry=3
9 years ago
# Then, npm install node modules
COPY package.json /tmp/npm/package.json
COPY frontend/*.json /tmp/npm/frontend/
RUN cd /tmp/npm/frontend/ && RAILS_ENV=production npm install && mv /tmp/npm/frontend /usr/src/app/
9 years ago
# Finally, copy over the whole thing
COPY . /usr/src/app
9 years ago
RUN cp docker/Procfile .
RUN sed -i "s|Rails.groups(:opf_plugins)|Rails.groups(:opf_plugins, :docker)|" config/application.rb
9 years ago
# Ensure we can write in /tmp/op_uploaded_files (cf. #29112)
RUN mkdir -p /tmp/op_uploaded_files/
RUN chown -R $APP_USER:$APP_USER /tmp/op_uploaded_files/
# Allow uploading avatars w/ postgres
RUN chown -R $APP_USER:$APP_USER $APP_DATA
# Re-use packager database.yml
COPY packaging/conf/database.yml ./config/database.yml
8 years ago
# Run the npm postinstall manually after it was copied
9 years ago
RUN DATABASE_URL=sqlite3:///tmp/db.sqlite3 SECRET_TOKEN=foobar RAILS_ENV=production bundle exec rake assets:precompile
# Include pandoc
6 years ago
RUN DATABASE_URL=sqlite3:///tmp/db.sqlite3 RAILS_ENV=production bundle exec rails runner "puts ::OpenProject::TextFormatting::Formats::Markdown::PandocDownloader.check_or_download!"
9 years ago
CMD ["./docker/web"]
ENTRYPOINT ["./docker/entrypoint.sh"]
VOLUME ["$APP_DATA"]