Files
ubicloud/Dockerfile
Enes Cakir b10d562b2a Update to Ruby 3.2.6
Heroku shows the following warning:

    remote: ###### WARNING:
    remote:
    remote:        There is a more recent Ruby version available for you to
    use:
    remote:
    remote:        3.2.6
    remote:
    remote:        The latest version will include security and bug fixes.
    We always recommend
    remote:        running the latest version of your minor release.
    remote:
    remote:        Please upgrade your Ruby version.
    remote:
    remote:        For all available Ruby versions see:
    remote:
    https://devcenter.heroku.com/articles/ruby-support#supported-runtimes

We don't have any reason to not upgrade
https://github.com/ruby/ruby/releases/tag/v3_2_6
2024-11-05 15:43:24 +03:00

51 lines
1.6 KiB
Docker

FROM node:22.9-alpine3.19 as frontend-builder
WORKDIR /app
COPY tailwind.config.js package.json package-lock.json ./
COPY views/ ./views/
COPY assets/ ./assets/
RUN npm ci
RUN npm run prod
FROM ruby:3.2.6-alpine3.19 as bundler
# Install build dependencies
# - build-base, git, curl: To ensure certain gems can be compiled
# - postgresql-dev: Required for postgresql gem
RUN apk update --no-cache && \
apk add build-base git curl postgresql-dev --no-cache
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local without development:test
RUN bundle install
FROM ruby:3.2.6-alpine3.19
# Install runtime dependencies
# - tzdata: The public-domain time zone database
# - curl: Required for healthcheck and some basic operations
# - postgresql-client: Required for postgresql gem at runtime
# - gcompat: Required for nokogiri gem at runtime. https://nokogiri.org/tutorials/installing_nokogiri.html#linux-musl-error-loading-shared-library
# - foreman: Helps to start different parts of app based on Procfile
RUN apk update --no-cache && \
apk add tzdata curl postgresql-client gcompat --no-cache && \
gem install foreman
RUN adduser -D ubicloud && \
mkdir /app && \
chown ubicloud:ubicloud /app
# Don't use root to run our app as extra line of defense
USER ubicloud
WORKDIR /app
# Copy built assets from builders
COPY --from=bundler /usr/local/bundle/ /usr/local/bundle/
COPY --chown=ubicloud --from=frontend-builder /app/assets/css/app.css /app/assets/css/app.css
COPY --chown=ubicloud . /app
ENV RACK_ENV=production
ENV PORT=3000
EXPOSE 3000
CMD ["foreman", "start"]