As only the docker client is executed in the image and not the docker daemon, only the docker-cli package is needed
39 lines
1.2 KiB
Docker
39 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-cli openssh-client-default yaml-dev \
|
|
&& 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"]
|