LoginSignup
0
0

More than 1 year has passed since last update.

React + Rails + AWS Fargate の構成を実現したい - 07 バックエンドのCI導入(GitHub Actions)

Last updated at Posted at 2022-08-27

目次

概要

本記事のゴール

以下を参考に、GitHub Actionsを用いたバックエンドのCI導入を行う。

成果

以下のように、ブランチにプッシュ後に、以下記事で書いたテストが実行されていることを確認した。

test.png

つまづいた点

以下つまづいた点をメモする。

1. yarnコマンドが見つからなくてエラー

エラー内容

Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "yarn": executable file not found in $PATH: unknown

解決策

以下でyarnコマンドをインストールする処理を /backend/Dockerfile に追加

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
RUN apt-get update -qq
RUN apt-get install -y nodejs yarn

2. rakeコマンドで失敗する

エラー内容

rake aborted!
Bundler::GemNotFound: Could not find msgpack-1.5.4 in any of the sources

解決策

以下を /.github/workflows/ci.yml に追加する

# 必要なアップデート
docker-compose run backend yarn install --check-files
docker-compose run backend yarn upgrade
+ # bundle installする
+ docker-compose run backend bundle install
# イメージのビルド
docker-compose build
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