0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Docker+Rails5.2エラー【Undefined local variable or method `git_source' for Gemfile from /Users/owner/projects/docker/rails-docker-vue2/Gemfile:2】の対処方法

Last updated at Posted at 2020-06-10

#Undefined local variable or method `git_source' for Gemfileの対処方法

credentials.ymlを編集時にエラー

$ EDITOR="vi" bin/rails credentials:edit
Undefined local variable or method `git_source' for Gemfile
        from /Users/owner/projects/docker/rails-docker-vue2/Gemfile:2

編集できず困った場合、下記の対処をする

Dockerで利用する場合

Rails on Dockerでcredentialsをeditしたい

Dockerfileに追加
apt-get install -y vim

Dockerfile
FROM ruby:2.5.1

RUN apt-get update -qq && \
    apt-get install -y build-essential \ 
                      libpq-dev \
                      git \
                      vim
#yarnのインストール
RUN apt-get update && apt-get install -y curl apt-transport-https wget && \
    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

#Nodejsをバージョン指定してインストール
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install nodejs

RUN mkdir /app_name 
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
ENV APP_ROOT /app_name 
WORKDIR $APP_ROOT

ADD ./Gemfile $APP_ROOT/Gemfile
ADD ./Gemfile.lock $APP_ROOT/Gemfile.lock

RUN bundle install
ADD . $APP_ROOT
buildして反映
$ docker-compose build
credetial.ymlの編集
$ docker-compose run -e EDITOR=vim web rails credentials:edit
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?