I think many teams use rbenv and Bundler to version control CocoaPods. The following is an example of using rbenv and Bundler to manage Ruby and CocoaPods versions. The Ruby version is fixed at 2.7.1, the Bundler version is fixed at 2.1.4, and the CocoaPods version is fixed at 1.9.2.
$ brew install rbenv ruby-build
$ rbenv install 2.7.1
$ gem install bundler -v 2.1.4
$ bundle config set path vendor/bundle
$ bundle _2.1.4_ install
$ bundle exec pod install
.ruby-version
2.7.1
Gemfile
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'cocoapods', '1.9.2'
gem 'cocoapods-binary', '0.4.4'
This method requires the installation of rbenv, which raises the bar for building an environment for non-engineers such as designers. This time, I tried to lower the hurdle a little by managing CocoaPods with Docker.
Prepare the following DockerFile and build the image. Add plugins and merge layers as you like.
Dockerfile
FROM ruby:2.7.1
RUN gem install cocoapods -v 1.9.2
RUN gem install cocoapods-binary -v 0.4.4
RUN adduser cocoapods
USER cocoapods
RUN pod setup
WORKDIR /project
$ docker build -t cocoapods-docker .
Go to your project's directory and do pod install
with the built image.
$ docker run --rm -v $PWD:/project cocoapods-docker pod install
I referred to this repository.
Recommended Posts