Я написал и закончил свое приложение Reactjs. Я хочу развернуть его на докере и nginx. Но вы можете помочь получить ошибку, как показано ниже:
Моя основная папка: мастерская Название проекта: стоматологический проект под ним: стоматологический проект (основная папка), Dockerfile, .dockerignore, package.json У меня есть файлы. Я получаю ошибки при сборке в мастерской. Вы помогаете, где я делаю не так?
сборка докера. -т стоматологический проект
# Stage 1
FROM node:12.13.0 as dentalproject
WORKDIR ./app
COPY . ./
RUN npm install
RUN npm run build
# Stage 2 - the production environment
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=dental project /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
added 2140 packages from 970 contributors and audited 908789 packages in 259.789s
found 87 vulnerabilities (5 low, 78 moderate, 4 high)
run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container 4f9e38aec49d
---> 305aa93a2803
Step 5/10 : RUN npm run build
---> Running in 02d39cf3e41d
> dentalproject@2.6.0 build /app
> react-scripts build
Creating an optimized production build...
<--- Last few GCs --->
[25:0x36b1ce0] 170147 ms: Mark-sweep 248.6 (258.4) -> 248.2 (258.6) MB, 789.2 / 0.1 ms (average mu = 0.110, current mu = 0.018) allocation failure scavenge might not succeed
[25:0x36b1ce0] 170974 ms: Mark-sweep 248.9 (258.6) -> 248.4 (258.9) MB, 810.4 / 0.1 ms (average mu = 0.065, current mu = 0.019) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x13725d9]
1: StubFrame [pc: 0x132eee7]
2: StubFrame [pc: 0x13d646e]
Security context: 0x17f4046408a1 <JSObject>
3: /* anonymous */(aka /* anonymous */) [0x41c5471e1c1] [/app/node_modules/webpack-sources/lib/applySourceMap.js:142] [bytecode=0x2699f46456d1 offset=505](this=0x07c3d9c804a9 <undefined>,0x041c54716261 <String[4]: var >,0x105a2f79e021 <Object map = 0xcb60430e031>)
4: walk(aka SourceNode_wal...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x9d8da0 node::Abort() [node]
2: 0x9d9f56 node::OnFatalError(char const*, char const*) [node]
3: 0xb37dbe v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb38139 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xce34f5 [node]
6: 0xce3b86 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0xcefa1a v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xcf0925 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xcf3338 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
10: 0xcbcae1 v8::internal::Factory::NewInternalizedStringImpl(v8::internal::Handle<v8::internal::String>, int, unsigned int) [node]
11: 0xeb6176 v8::internal::InternalizedStringKey::AsHandle(v8::internal::Isolate*) [node]
12: 0xec973f v8::internal::StringTable::AddKeyNoResize(v8::internal::Isolate*, v8::internal::StringTableKey*) [node]
13: 0xed29d6 v8::internal::Handle<v8::internal::String> v8::internal::StringTable::LookupKey<v8::internal::InternalizedStringKey>(v8::internal::Isolate*, v8::internal::InternalizedStringKey*) [node]
14: 0xed2ab6 v8::internal::StringTable::LookupString(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>) [node]
15: 0x1003f13 v8::internal::JSReceiver::HasProperty(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::Name>) [node]
16: 0x1009738 v8::internal::Runtime_HasProperty(int, unsigned long*, v8::internal::Isolate*) [node]
17: 0x13725d9 [node]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dentalproject@2.6.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dentalproject@2.6.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-10-24T13_28_58_834Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
frontend@frontendubuntu:~/workshop/dentalproject$