We previously installed only the production gems in the Docker image, but since it's used only for demo purposes and not for our production, we need all the gems. Running the demo in development mode failed because some gems were missing. ubicloud-app | 10:58:33 respirate.1 | /usr/local/bundle/gems/bundler-2.5.17/lib/bundler/definition.rb:601:in `materialize': Could not find awesome_print-1.9.2, by-1.1.0, pry-byebug-3.10.1, rackup-2.2.1, cuprite-0.15.1, sequel-annotate-1.7.0, byebug-11.1.3, capybara-3.40.0, ferrum-0.15, rack-test-2.2.0, xpath-3.2.0, webrick-1.9.1, websocket-driver-0.7.7, websocket-extensions-0.1.5 in locally installed gems (Bundler::GemNotFound) So, we decided to install all gems in the Docker image since it's only for demo purposes. I think it might be broken due to the change in https://github.com/ubicloud/ubicloud/pull/2425, but I'm not sure. Fixes #2575
51 lines
1.5 KiB
Docker
51 lines
1.5 KiB
Docker
FROM node:23.2-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 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"]
|