Когда я пытаюсь использовать этот файл докеров:
FROM ruby:2.6.6-alpine
RUN apk --update --no-cache add build-base linux-headers nodejs yarn mariadb-dev tzdata
RUN apk --update --no-cache add --virtual build-dependencies make g++
RUN mkdir -p /app/disease-trakker
RUN mkdir -p /app/disease-trakker/app/assets/stylesheets
COPY Gemfile Gemfile.lock /app/disease-trakker/
WORKDIR /app/disease-trakker
RUN gem install bundler && bundle config set without 'development test' && bundle config set deployment 'true'
RUN bundle install --jobs $(nproc)
RUN yarn install
RUN apk del build-dependencies && rm -rf /var/cache/apk/* && rm -rf /usr/local/bundle/cache/*.gem && find /usr/local/bundle/gems/ -name "*.c" -delete
RUN addgroup -g 1000 -S app && adduser -u 1000 -S app -G app
COPY . /app/disease-trakker
RUN yarn global add node-gyp
RUN yarn install --no-optional
RUN yarn cache clean
RUN RAILS_ENV=production SECRET_KEY_BASE=precompile_only bundle exec rake assets:precompile
RUN rm -rf node_modules tmp/ vendor/assets lib/assets test/
ENV RAILS_SERVE_STATIC_FILES true
ENV RAILS_LOG_TO_STDOUT true
ENV RAILS_ENV production
COPY docker-entrypoint.sh /usr/local/bin
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN chown app:app /usr/local/bundle/config
RUN chown -R app:app /app/disease-trakker
USER app
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
Чтобы создать образ на AWS CodeBuild, он терпит неудачу примерно 4 из каждых 5 запусков на шаге:
RUN RAILS_ENV=production SECRET_KEY_BASE=precompile_only bundle exec rake assets:precompile
С сообщением:
Compilation failed:
events.js:292
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at ChildProcess.target._send (internal/child_process.js:806:20)
at ChildProcess.target.send (internal/child_process.js:677:19)
at ChildProcessWorker.send (/app/disease-trakker/node_modules/jest-worker/build/workers/ChildProcessWorker.js:291:17)
at WorkerPool.send (/app/disease-trakker/node_modules/jest-worker/build/WorkerPool.js:32:34)
at Farm._process (/app/disease-trakker/node_modules/jest-worker/build/Farm.js:129:10)
at Farm._enqueue (/app/disease-trakker/node_modules/jest-worker/build/Farm.js:152:10)
at Farm._push (/app/disease-trakker/node_modules/jest-worker/build/Farm.js:159:12)
at /app/disease-trakker/node_modules/jest-worker/build/Farm.js:90:14
at new Promise (<anonymous>)
at Farm.doWork (/app/disease-trakker/node_modules/jest-worker/build/Farm.js:56:12)
at JestWorker._callFunctionWithArgs (/app/disease-trakker/node_modules/jest-worker/build/index.js:143:23)
at TaskRunner.runTask (/app/disease-trakker/node_modules/terser-webpack-plugin/dist/TaskRunner.js:41:26)
at enqueue (/app/disease-trakker/node_modules/terser-webpack-plugin/dist/TaskRunner.js:89:35)
at /app/disease-trakker/node_modules/terser-webpack-plugin/dist/TaskRunner.js:113:86
Emitted 'error' event on ChildProcess instance at:
at internal/child_process.js:810:39
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
The command '/bin/sh -c RAILS_ENV=production SECRET_KEY_BASE=precompile_only bundle exec rake assets:precompile' returned a non-zero code: 1
Он также дает сбой на моем локальном компьютере, но реже.
Почему происходит сбой моей сборки? Какие шаги я могу предпринять для устранения этой проблемы?