mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-10 16:54:38 -04:00
* Add Docker, Docker Compose, and GitHub Actions CI support - Added a production-ready `Dockerfile` based on Ruby 3.3.8-bullseye. - Added `entrypoint.sh` to handle Rails server PID cleanup. - Added `.dockerignore` to optimize build context. - Added `docker-compose.yml` for local orchestration of Rails, PostgreSQL 17, and Elasticsearch 7.4.0. - Added GitHub Actions workflow in `.github/workflows/docker-build-push.yml` to build and push the image to GHCR on pushes to the `dev` branch. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Swap to 3.4.8 * Node 22 * Apply suggestion from @CloCkWeRX --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
53 lines
1.4 KiB
Docker
53 lines
1.4 KiB
Docker
FROM ruby:3.4.8-trixie
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libpq-dev \
|
|
git \
|
|
curl \
|
|
gnupg2 \
|
|
shared-mime-info \
|
|
libvips \
|
|
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
&& apt-get install -y --no-install-recommends nodejs \
|
|
&& npm install -g yarn \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set production environment
|
|
ENV RAILS_ENV=production \
|
|
BUNDLE_WITHOUT="development test" \
|
|
RAILS_SERVE_STATIC_FILES=true \
|
|
RAILS_LOG_TO_STDOUT=true
|
|
|
|
WORKDIR /app
|
|
|
|
# Install gems
|
|
COPY Gemfile Gemfile.lock ./
|
|
RUN bundle config set --local deployment 'true' && \
|
|
bundle config set --local without 'development test' && \
|
|
bundle install --jobs 4 --retry 3
|
|
|
|
# Install JavaScript dependencies
|
|
COPY package.json yarn.lock ./
|
|
RUN yarn install --check-files
|
|
|
|
# Copy the application code
|
|
COPY . .
|
|
|
|
# Precompile assets
|
|
# Secret key base is needed for asset compilation but doesn't need to be the real one
|
|
RUN RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 bundle exec rake assets:precompile
|
|
|
|
# Add a script to be executed every time the container starts.
|
|
COPY entrypoint.sh /usr/bin/
|
|
RUN chmod +x /usr/bin/entrypoint.sh
|
|
ENTRYPOINT ["entrypoint.sh"]
|
|
|
|
EXPOSE 3000
|
|
|
|
# Start the main process.
|
|
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|