See: https://github.com/sparklemotion/nokogiri/releases/tag/v1.18.0 - required for ruby 3.4 compatibility - add more platforms to lockfile to support docker build process, due to changes in the nokogiri native gem setup where -musl and -gnu linux platforms are no longer interchangeable - bundler >= 2.5.6 required according to Nokogiri release notes, so updated to current latest version (2.6.5)
40 lines
1.2 KiB
Docker
40 lines
1.2 KiB
Docker
FROM ruby:3.4-alpine
|
|
|
|
# Install docker/buildx-bin
|
|
COPY --from=docker/buildx-bin /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
|
|
|
# Set the working directory to /kamal
|
|
WORKDIR /kamal
|
|
|
|
# Copy the Gemfile, Gemfile.lock into the container
|
|
COPY Gemfile Gemfile.lock kamal.gemspec ./
|
|
|
|
# Required in kamal.gemspec
|
|
COPY lib/kamal/version.rb /kamal/lib/kamal/version.rb
|
|
|
|
# Install system dependencies
|
|
RUN apk add --no-cache build-base git docker openrc openssh-client-default yaml-dev \
|
|
&& rc-update add docker boot \
|
|
&& gem install bundler --version=2.6.5 \
|
|
&& bundle install
|
|
|
|
# Copy the rest of our application code into the container.
|
|
# We do this after bundle install, to avoid having to run bundle
|
|
# every time we do small fixes in the source code.
|
|
COPY . .
|
|
|
|
# Install the gem locally from the project folder
|
|
RUN gem build kamal.gemspec && \
|
|
gem install ./kamal-*.gem --no-document
|
|
|
|
# Set the working directory to /workdir
|
|
WORKDIR /workdir
|
|
|
|
# Tell git it's safe to access /workdir/.git even if
|
|
# the directory is owned by a different user
|
|
RUN git config --global --add safe.directory '*'
|
|
|
|
# Set the entrypoint to run the installed binary in /workdir
|
|
# Example: docker run -it -v "$PWD:/workdir" kamal init
|
|
ENTRYPOINT ["kamal"]
|