From c8b44f4636a763eafc0feda7eeeacc7b442346b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Wed, 10 Dec 2025 16:09:38 -0600 Subject: [PATCH] Containerize application --- Dockerfile | 28 ++++++++++++++++++++++++++++ Gemfile | 10 +++++----- Gemfile.lock | 30 ------------------------------ docker-compose.yml | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 35 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..81521fefc426 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM ruby:2.1.10 + +WORKDIR /app + +# # Install system dependencies +# RUN apt-get update -qq && apt-get install -y \ +# build-essential \ +# libmysqlclient-dev \ +# mysql-client \ +# nodejs \ +# && rm -rf /var/lib/apt/lists/* + +# Copy Gemfile and Gemfile.lock +COPY Gemfile Gemfile.lock ./ + +# Install Ruby dependencies +ENV BUNDLER_VERSION=1.10.5 +RUN gem install bundler -v 1.10.5 +RUN bundle install + +# # Copy application code +COPY . . +# +# # Expose port 3000 +# EXPOSE 5000 + +# # Start the application +# CMD ["bundle", "exec", "unicorn", "-p", "3000"] diff --git a/Gemfile b/Gemfile index fe469df990b4..3671bfc90264 100644 --- a/Gemfile +++ b/Gemfile @@ -50,7 +50,7 @@ gem 'rails_autolink', '~> 1.1.6' gem 'will_paginate', '~> 3.0' gem 'acts_as_list', '~> 0.3.0' -gem 'awesome_nested_set', github: 'finnlabs/awesome_nested_set', branch: 'v2.1.6-rails4' +# gem 'awesome_nested_set'#, github: 'collectiveidea/awesome_nested_set', branch: 'v2.1.6-rails4' gem 'color-tools', '~> 1.3.0', require: 'color' @@ -79,7 +79,7 @@ gem 'daemons' # include custom rack-protection for now until rkh/rack-protection is fixed and released # (see https://community.openproject.org/work_packages/3029) -gem 'rack-protection', git: 'https://github.com/finnlabs/rack-protection.git', ref: '5a7d1bd' +# gem 'rack-protection', git: 'https://github.com/finnlabs/rack-protection.git', ref: '5a7d1bd' # Rack::Attack is a rack middleware to protect your web app from bad clients. # It allows whitelisting, blacklisting, throttling, and tracking based on arbitrary properties of the request. @@ -150,11 +150,11 @@ group :test do # also add to development group, so "spec" rake task gets loaded gem 'rspec-rails', '~> 3.3.0', group: :development gem 'rspec-activemodel-mocks' - gem 'rspec-example_disabler', git: 'https://github.com/finnlabs/rspec-example_disabler.git' + # gem 'rspec-example_disabler', git: 'https://github.com/finnlabs/rspec-example_disabler.git' gem 'rspec-legacy_formatters' gem 'capybara', '~> 2.3.0' gem 'capybara-screenshot', '~> 1.0.4' - gem 'capybara-select2', github: 'goodwill/capybara-select2' + # gem 'capybara-select2', github: 'goodwill/capybara-select2' gem 'capybara-ng', '~> 0.2.1' gem 'selenium-webdriver', '~> 2.45.0' gem 'timecop', '~> 0.7.1' @@ -166,7 +166,7 @@ group :test do gem 'shoulda-matchers', '~> 2.8', require: nil gem 'json_spec' gem 'activerecord-tableless', '~> 1.0' - gem 'codecov', require: nil + # gem 'codecov', require: nil gem 'equivalent-xml', '~> 0.5.1' end diff --git a/Gemfile.lock b/Gemfile.lock index 2c74a16e0b9c..b866ffee3d38 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,33 +1,3 @@ -GIT - remote: git://github.com/finnlabs/awesome_nested_set.git - revision: 787a9cdcd4d11f9c09f4800520f5968c740110f4 - branch: v2.1.6-rails4 - specs: - awesome_nested_set (2.1.6) - activerecord (>= 3.0.0) - -GIT - remote: git://github.com/goodwill/capybara-select2.git - revision: c0826f33707b85fd39a838c6909ee12d0bff64a1 - specs: - capybara-select2 (1.0.1) - capybara - rspec - -GIT - remote: https://github.com/finnlabs/rack-protection.git - revision: 5a7d1bd2f05ca75faf7909c8cc978732a0080898 - ref: 5a7d1bd - specs: - rack-protection (1.5.2) - rack - -GIT - remote: https://github.com/finnlabs/rspec-example_disabler.git - revision: deb9c38e3f4e3688724583ac1ff58e1ae8aba409 - specs: - rspec-example_disabler (0.0.1) - GIT remote: https://github.com/rails/prototype_legacy_helper.git revision: a2cd95c3e3c1a4f7a9566efdab5ce59c886cb05f diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000000..f7dc8b122bc5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +services: + db: + platform: "linux/amd64" + image: postgres:13.23 + environment: + POSTGRES_DB: openproject + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + volumes: + - postgres_data:/var/lib/postgresql/data + ports: + - "5432:5432" + + app: + build: . + container_name: openproject + image: openproject:latest + platform: "linux/arm64" + # ports: + # - "5000:5000" + depends_on: + - db + environment: + DATABASE_URL: postgresql://postgres:password@db:5432/openproject + RAILS_ENV: production + volumes: + - .:/app + - bundle_cache:/usr/local/bundle + +volumes: + postgres_data: + bundle_cache: