You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
Add Docker support to the project to ensure consistency between local development and the CI pipeline. This will help mimic the CI environment locally, allowing for early detection of issues before code is pushed to GitHub.
Steps to Implement
Create Dockerfile:
Add a Dockerfile to the project root with the necessary configuration to set up the development environment.
Ensure the Dockerfile includes:
Installation of Ruby 3.2.2
Installation of Node.js
Installation of Postgres client
Installation of necessary gems and npm packages
Precompilation of assets
Update Database Configuration:
Update config/database.yml to use environment variables for database configuration, allowing for easy configuration in Docker.
Create Docker Compose File (Optional):
Add a docker-compose.yml file to define and run multi-container Docker applications.
Include services for the app and Postgres database.
4.Update Documentation:
Update README.md with instructions on how to build and run the Docker container locally.
Include steps for running tests within the Docker container.
Example Dockerfile:
# Use the official Ruby image as a base
FROM ruby:3.2.2
# Install Node.js
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
# Install Postgres client
RUN apt-get update -qq && apt-get install -y postgresql-client
# Set up working directory
WORKDIR /app
# Copy the Gemfile and Gemfile.lock
COPY Gemfile* ./
# Install bundler and gems
RUN gem install bundler:2.5.5
RUN bundle install
# Copy the rest of the application code
COPY . .
# Install npm dependencies
RUN npm install --legacy-peer-deps
# Precompile assets
RUN node build.ci.js
# Expose the port your app runs on
EXPOSE 3000
# Start the main process
CMD ["rails", "server", "-b", "0.0.0.0"]
Description
Add Docker support to the project to ensure consistency between local development and the CI pipeline. This will help mimic the CI environment locally, allowing for early detection of issues before code is pushed to GitHub.
Steps to Implement
4.Update Documentation:
Example Dockerfile:
Example docker-compose.yml (Optional):
Example Database Configuration:
Run Tests in the Docker Container
docker-compose run web bundle exec rspec