githubにプッシュする際、circleciで自動テストを行おうとしましたが、bundle install ,restoring cache, Installing Node modules で失敗しました
エラー restoring cache
error computing cache key: template: cacheKey:1:30: executing "cacheKey" at <checksum "~/project/yarn.lock">: error calling checksum: open /home/circleci/project/yarn.lock: no such file or directory
エラー Installing Node modules
#!/bin/bash -eo pipefail if [ ! -f "package.json" ]; then echo echo "---" echo "Unable to find your package.json file. Did you forget to set the app-dir parameter?" echo "---" echo echo "Current directory: $(pwd)" echo echo echo "List directory: " echo ls exit 1 fi case yarn in npm) if [[ "false" == "true" ]]; then npm install else npm ci fi ;; yarn) if [[ "false" == "true" ]]; then yarn install else yarn install --frozen-lockfile fi ;; esac
.circleci/config.yml
version: 2.1 orbs: ruby: circleci/ruby@1.1.2 node: circleci/node@2 # setup commands: setup: steps: - checkout - ruby/install-deps - node/install-packages: pkg-manager: yarn cache-key: "yarn.lock" jobs: build: docker: - image: circleci/ruby:2.7.1-node working_directory: ~/videoapp steps: - setup test: docker: - image: circleci/ruby:2.7.1-node - image: circleci/postgres:11.6-alpine name: "db" environment: POSTGRES_USER: postgres POSTGRES_DB: myapp_test POSTGRES_PASSWORD: "" environment: BUNDLE_JOBS: "4" BUNDLE_RETRY: "3" PGHOST: 127.0.0.1 PGUSER: postgres PGPASSWORD: "" RAILS_ENV: test working_directory: ~/videoapp steps: - setup - run: name: rails db:migrate command: bundle exec rails db:migrate - run: name: Database setup command: bundle exec rails db:schema:load --trace - run: name: Rspec command: bundle exec rspec workflows: version: 2 test_and_deploy: jobs: - build - test: requires: - build
Dockerfile
FROM ruby:2.7.1 RUN apt-get update -qq && apt-get install -y nodejs postgresql-client 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 # Node.jsをインストール RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - && \ apt-get install nodejs RUN mkdir /myapp WORKDIR /myapp COPY Gemfile /myapp/Gemfile COPY Gemfile.lock /myapp/Gemfile.lock RUN bundle install COPY . /myapp # Add a script to be executed every time the container starts. COPY entrypoint.sh /usr/bin/ RUN chmod +x /usr/bin/entrypoint.sh ENTRYPOINT ["entrypoint.sh"] EXPOSE 3000 # Start the main process. CMD ["rails", "server", "-b", "0.0.0.0"]
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/06/19 05:31
2021/06/19 05:38