Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG. Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.0 KiB
Docker
72 lines
2.0 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
ARG RUBY_VERSION=3.3.6
|
|
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
|
|
|
WORKDIR /rails
|
|
|
|
RUN apt-get update -qq && \
|
|
apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client libyaml-0-2 && \
|
|
ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
|
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
|
|
ENV BUNDLE_PATH="/usr/local/bundle" \
|
|
LD_PRELOAD="/usr/local/lib/libjemalloc.so"
|
|
|
|
# Development image (locale)
|
|
FROM base AS development
|
|
|
|
RUN apt-get update -qq && \
|
|
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips libyaml-dev pkg-config && \
|
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
|
|
ENV RAILS_ENV=development \
|
|
BUNDLE_WITHOUT=""
|
|
|
|
COPY Gemfile Gemfile.lock ./
|
|
RUN bundle install
|
|
|
|
COPY . .
|
|
|
|
EXPOSE 3000
|
|
CMD ["bin/rails", "server", "-b", "0.0.0.0", "-p", "3000"]
|
|
|
|
# Production build
|
|
FROM base AS build
|
|
|
|
RUN apt-get update -qq && \
|
|
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips libyaml-dev pkg-config && \
|
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
|
|
ENV RAILS_ENV=production \
|
|
BUNDLE_DEPLOYMENT=1 \
|
|
BUNDLE_WITHOUT="development:test"
|
|
|
|
COPY Gemfile Gemfile.lock ./
|
|
RUN bundle install && \
|
|
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
|
|
|
|
COPY . .
|
|
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails tailwindcss:build && \
|
|
SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
|
|
|
FROM base AS production
|
|
|
|
ENV RAILS_ENV=production \
|
|
BUNDLE_DEPLOYMENT=1 \
|
|
BUNDLE_WITHOUT="development:test" \
|
|
RAILS_LOG_TO_STDOUT=true
|
|
|
|
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
|
COPY --from=build /rails /rails
|
|
|
|
RUN mkdir -p db log storage tmp public && \
|
|
chmod +x bin/docker-entrypoint && \
|
|
useradd rails --create-home --shell /bin/bash && \
|
|
chown -R rails:rails db log storage tmp public
|
|
USER rails:rails
|
|
|
|
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
|
EXPOSE 3000
|
|
CMD ["./bin/rails", "server", "-b", "0.0.0.0", "-p", "3000"]
|