# syntax = docker/dockerfile:1
ARG NODE_VERSION=20.9
FROM node:${NODE_VERSION}-slim as base
ARG PORT=3000
ENV NODE_ENV=production
WORKDIR /src
# Build
FROM base as build
COPY --link package.json package-lock.json ./
RUN npm install --production=false
COPY --link . .
RUN npm run build
RUN npm prune
# Run
FROM base
ENV PORT=$PORT
COPY --from=build /src/.output /src/.output
# Optional, only needed if you rely on unbundled dependencies
# COPY --from=build /src/node_modules /src/node_modules
CMD [ "node", ".output/server/index.mjs" ]
version: '3.7'
services:
frontend:
container_name: frontend
image: $REGISTRY/prod/main:$CI_COMMIT_SHORT_SHA
restart: always
expose:
- 80
environment:
NODE_OPTIONS: '--max_old_space_size=4096'
VIRTUAL_HOST: $FRONTEND_DOMAIN
LETSENCRYPT_HOST: $FRONTEND_DOMAIN
HTTPS_METHOD: noredirect
VIRTUAL_PORT: 80
NITRO_PORT: 80
PORT: 80
NUXT_SITE_URL: $NUXT_SITE_URL
NUXT_API_URL: $NUXT_API_URL
NUXT_API_REFERRER: $NUXT_API_REFERRER
NUXT_SEARCH_API_KEY: $NUXT_SEARCH_API_KEY
NUXT_SEARCH_HOST: $NUXT_SEARCH_HOST
NUXT_SEARCH_PORT: $NUXT_SEARCH_PORT
NUXT_SEARCH_PROTOCOL: $NUXT_SEARCH_PROTOCOL
networks:
- frontend
- reverse-proxy
networks:
reverse-proxy:
external:
name: reverse-proxy
frontend:
driver: bridge
Listening on http://[::]:80
<--- Last few GCs --->
[1:0x614b7c0] 4292189 ms: Mark-Compact 4033.3 (4127.3) -> 4014.6 (4125.2) MB, 4168.40 / 0.02 ms (average mu = 0.264, current mu = 0.137) allocation failure; scavenge might not succeed
[1:0x614b7c0] 4297233 ms: Mark-Compact 4034.3 (4127.3) -> 4016.3 (4125.6) MB, 4291.61 / 0.02 ms (average mu = 0.210, current mu = 0.149) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xc99970 node::Abort() [node]
2: 0xb6ffcb [node]
3: 0xebe9f0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
4: 0xebecd7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
5: 0x10d0785 [node]
6: 0x10d0d14 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0x10e7c04 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [node]
8: 0x10e841c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0x10be721 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0x10bf8b5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
12: 0x14f7c56 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
13: 0x7f5077ed9ef6
frontend | ➜ Local: http://0.0.0.0:/
frontend | ➜ Network: http://172.21.0.2:/ [QR code]
frontend |
frontend | [nuxt:tailwindcss] ℹ Using default Tailwind CSS file
frontend | ℹ Vite server warmed up in 43668ms
frontend | ℹ Vite client warmed up in 52475ms
frontend | [nitro] ✔ Nitro built in 2394 ms
frontend | [nitro] [uncaughtException] Error: listen EADDRINUSE: address already in use /tmp/nitro/worker-30-1.sock
frontend | at Server.setupListenHandle [as _listen2] (node:net:1880:21)
frontend | at listenInCluster (node:net:1945:12)
frontend | at Server.listen (node:net:2054:5)
frontend | at <anonymous> (/src/node_modules/nitropack/dist/runtime/entries/nitro-dev.mjs:26:25)
frontend | at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
frontend | at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
frontend | at async loadESM (node:internal/process/esm_loader:28:7)
frontend | at async handleMainPromise (node:internal/modules/run_main:113:12) {
frontend | code: 'EADDRINUSE',
frontend | errno: -98,
frontend | syscall: 'listen',
frontend | address: '/tmp/nitro/worker-30-1.sock',
frontend | port: -1
frontend | }
Как раз в этом и проблема, что у себя не собирается, на сервере собирается. Нехватки RAM нету, из 16 свободно 10, ограничений контейнеру не ставил