Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions run/rails/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,38 @@
FROM ruby:3.2-buster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: if there's an issue with buster, why not update the base image to bookworm? Does that version have the same issue?

# [END cloudrun_rails_base_image]

RUN (curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | apt-key add -) && \
echo "deb https://deb.nodesource.com/node_20.x buster main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get update && apt-get install -y nodejs lsb-release
# Replace expired Buster repositories with archive.debian.org
RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list && \
sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list && \
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/10no-check-valid-until && \
apt-get update

# Install Node.js (from NodeSource)
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | \
gpg --dearmor -o /usr/share/keyrings/nodesource.gpg && \
echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x buster main" > \
/etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y nodejs lsb-release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it would make more sense to install the lsb-release package in the same step that the repository is setup


# Install Yarn
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | \
gpg --dearmor -o /usr/share/keyrings/yarn.gpg && \
echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > \
/etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y yarn

RUN (curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -) && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y yarn

WORKDIR /app

# Application dependencies
COPY Gemfile Gemfile.lock ./

RUN gem install bundler && \
bundle config set --local deployment 'true' && \
bundle config set --local without 'development test' && \
bundle install
bundle config set --local deployment 'true' && \
bundle config set --local without 'development test' && \
bundle install
Comment on lines -24 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It's useful when using command continuations to use indenting to make it clear that this is all one layer, one run command.

Please apply to other commands.



# Copy application code to the container image
Expand Down