<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: @Arcgis/core with Next JS build in Docker fails due to out of memory error in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046608#M72505</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can you provide your Dockerfile and some more information about your environment? The&lt;SPAN&gt;&amp;nbsp;sample works on my end with the Dockerfile below. I'm on Windows using the Hyper-V backend. I'll test on my Linux machine as well, but unfortunately I don't have a Mac.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Install dependencies only when needed
FROM node:alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json ./
RUN mkdir -p /app/public/assets
RUN npm ci

# Rebuild the source code only when needed
FROM node:alpine AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build

# Production image, copy all the files and run next
FROM node:alpine AS runner
WORKDIR /app

ENV NODE_ENV production

# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
RUN chown -R nextjs:nodejs /app/.next
USER nextjs

EXPOSE 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
RUN npx next telemetry disable

CMD ["npm", "start"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: most of that is from the &lt;A href="https://nextjs.org/docs/deployment#docker-image" target="_self"&gt;NextJS deployment doc&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Apr 2021 20:31:08 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-04-13T20:31:08Z</dc:date>
    <item>
      <title>@Arcgis/core with Next JS build in Docker fails due to out of memory error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046490#M72492</link>
      <description>&lt;P&gt;Followed the instructions &lt;A href="https://www.esri.com/arcgis-blog/products/js-api-arcgis/developers/ssr-esm/" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;by &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/71373"&gt;@BenElan&lt;/a&gt;&amp;nbsp;in setting up ArcGIS in a Next JS app.&lt;/P&gt;&lt;P&gt;For this test, I have used&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/71373"&gt;@BenElan&lt;/a&gt;&amp;nbsp; &lt;A href="https://github.com/benelan/arcgis-esm-samples" target="_self"&gt;repository sample &amp;nbsp;&lt;/A&gt;&amp;nbsp;in particular, jaspi-create-next-app.&amp;nbsp;&lt;/P&gt;&lt;P&gt;All works fine in my local computer, and I was able to run `yarn build` successfully.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added a new Dockerfile.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the build fails when I run `yarn build` inside a Docker container.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I confirm that by removing the `EsriMapwithNoSSR` component will result in a successful build. So the issue lies with the way &lt;A href="mailto:arcgis@core" target="_blank" rel="noopener"&gt;arcgis@core&lt;/A&gt;&amp;nbsp;and Next JS works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect a memory leak is occurring somewhere.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the logs from the build :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;Mings-MacBook-Pro:jsapi-create-next-app ming$ docker build . -t test2&lt;BR /&gt;[+] Building 154.9s (10/10) FINISHED&lt;BR /&gt;=&amp;gt; [internal] load build definition from Dockerfile 0.0s&lt;BR /&gt;=&amp;gt; =&amp;gt; transferring dockerfile: 37B 0.0s&lt;BR /&gt;=&amp;gt; [internal] load .dockerignore 0.0s&lt;BR /&gt;=&amp;gt; =&amp;gt; transferring context: 34B 0.0s&lt;BR /&gt;=&amp;gt; [internal] load metadata for docker.io/library/node:15.5.0-alpine 0.9s&lt;BR /&gt;=&amp;gt; [1/6] FROM docker.io/library/node:15.5.0-alpine@sha256:5b91260f78485bfd4a1614f1afa9afd59920e4c35047ed1c2b8cde4 0.0s&lt;BR /&gt;=&amp;gt; [internal] load build context 0.4s&lt;BR /&gt;=&amp;gt; =&amp;gt; transferring context: 296.34kB 0.3s&lt;BR /&gt;=&amp;gt; CACHED [2/6] WORKDIR /user/src/playstation 0.0s&lt;BR /&gt;=&amp;gt; [3/6] COPY package.json . 0.1s&lt;BR /&gt;=&amp;gt; [4/6] RUN yarn 72.0s&lt;BR /&gt;=&amp;gt; [5/6] COPY . . 0.8s&lt;BR /&gt;=&amp;gt; ERROR [6/6] RUN yarn build 80.5s&lt;BR /&gt;------&lt;BR /&gt;&amp;gt; [6/6] RUN yarn build:&lt;BR /&gt;#10 0.921 yarn run v1.22.5&lt;BR /&gt;#10 1.040 $ next build&lt;BR /&gt;#10 2.922 Browserslist: caniuse-lite is outdated. Please run:&lt;BR /&gt;#10 2.922 npx browserslist@latest --update-db&lt;BR /&gt;#10 3.278 info - Creating an optimized production build...&lt;BR /&gt;#10 3.309 Attention: Next.js now collects completely anonymous telemetry regarding usage.&lt;BR /&gt;#10 3.309 This information is used to shape Next.js' roadmap and prioritize features.&lt;BR /&gt;#10 3.309 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:&lt;BR /&gt;#10 3.309 &lt;A href="https://nextjs.org/telemetry" target="_blank" rel="noopener"&gt;https://nextjs.org/telemetry&lt;/A&gt;&lt;BR /&gt;#10 3.309&lt;BR /&gt;#10 79.91 error Command failed with signal "SIGKILL".&lt;BR /&gt;#10 79.91 info Visit &lt;A href="https://yarnpkg.com/en/docs/cli/run" target="_blank" rel="noopener"&gt;https://yarnpkg.com/en/docs/cli/run&lt;/A&gt; for documentation about this command.&lt;BR /&gt;------&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 17:49:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046490#M72492</guid>
      <dc:creator>zhenming91</dc:creator>
      <dc:date>2021-04-13T17:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: @Arcgis/core with Next JS build in Docker fails due to out of memory error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046525#M72497</link>
      <description>&lt;P&gt;With the next build, you don't need to copy the assets by default anymore. If you have that in there, you can remove it and it will save on files copied and processed. This will cut down a solid 20MB+ of static asset files on disk in the build. Other than that, it wouldn't be a memory leak issue with the API.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 18:28:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046525#M72497</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-04-13T18:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: @Arcgis/core with Next JS build in Docker fails due to out of memory error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046543#M72502</link>
      <description>&lt;P&gt;Hey Rene,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am not clear with what you are suggesting.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The map wouldn't function without the assets in the public folder. I have just tried it. The&amp;nbsp;@Anonymous User/core version that I am using is 4.18.1&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 18:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046543#M72502</guid>
      <dc:creator>zhenming91</dc:creator>
      <dc:date>2021-04-13T18:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: @Arcgis/core with Next JS build in Docker fails due to out of memory error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046566#M72503</link>
      <description>&lt;P&gt;Use the &lt;STRONG&gt;next&lt;/STRONG&gt; build as described &lt;A href="https://github.com/Esri/feedback-js-api-next" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;npm install @Anonymous User/core@next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 19:22:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046566#M72503</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-04-13T19:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: @Arcgis/core with Next JS build in Docker fails due to out of memory error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046608#M72505</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can you provide your Dockerfile and some more information about your environment? The&lt;SPAN&gt;&amp;nbsp;sample works on my end with the Dockerfile below. I'm on Windows using the Hyper-V backend. I'll test on my Linux machine as well, but unfortunately I don't have a Mac.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Install dependencies only when needed
FROM node:alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json ./
RUN mkdir -p /app/public/assets
RUN npm ci

# Rebuild the source code only when needed
FROM node:alpine AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build

# Production image, copy all the files and run next
FROM node:alpine AS runner
WORKDIR /app

ENV NODE_ENV production

# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
RUN chown -R nextjs:nodejs /app/.next
USER nextjs

EXPOSE 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
RUN npx next telemetry disable

CMD ["npm", "start"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: most of that is from the &lt;A href="https://nextjs.org/docs/deployment#docker-image" target="_self"&gt;NextJS deployment doc&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 20:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046608#M72505</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-04-13T20:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: @Arcgis/core with Next JS build in Docker fails due to out of memory error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046613#M72506</link>
      <description>&lt;P&gt;When 4.19 is released I'll update the samples with the change Rene mentioned.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 20:16:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1046613#M72506</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-04-13T20:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: @Arcgis/core with Next JS build in Docker fails due to out of memory error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1047046#M72528</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my Docker file, and I am using Mac OS.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FROM node:15.5.0-alpine

WORKDIR /user/src/playstation

COPY package.json .

RUN yarn

COPY . .

RUN yarn build

EXPOSE 3000

CMD yarn start&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I have used the next build, and true enough the assets are no longer required. However, running using your Dockerfile result in the same error. So that didn't solve it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What I did was to increase my Docker resource memory from 1GB initially to 8.5GB, and it works now. I have no clue why this resolves it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zhenming91_0-1618416094614.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/10875i7DBDF14AB039C5A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zhenming91_0-1618416094614.png" alt="zhenming91_0-1618416094614.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 16:02:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-core-with-next-js-build-in-docker-fails-due/m-p/1047046#M72528</guid>
      <dc:creator>zhenming91</dc:creator>
      <dc:date>2021-04-14T16:02:02Z</dc:date>
    </item>
  </channel>
</rss>

