Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Webpack stucks in Docker Container #313

Open
Memo99 opened this issue Sep 4, 2021 · 3 comments
Open

Webpack stucks in Docker Container #313

Memo99 opened this issue Sep 4, 2021 · 3 comments

Comments

@Memo99
Copy link

Memo99 commented Sep 4, 2021

I created a project using

npx create-strapi-app my-project --quickstart

created a Dockerfile:

FROM strapi/base

WORKDIR /srv/app

COPY ./package.json ./
COPY ./yarn.lock ./

RUN yarn install

COPY . .

ENV NODE_ENV production

RUN yarn build

EXPOSE 1337

CMD ["yarn", "start"]

Now i'm trying to build the Docker Image, but it stucks always when building the webpack.

When I manually start yarn build in the container, then i can see that it's stuck at 90% processing chunk assets.

My container has 4GB Ram and 2 cpus attached. I can see that its using 100% SSD Read the whole time.

Do you have any suggestions?

@giuseppealbrizio
Copy link

Do you have Docker trying run strapi/base image on linux/arm64/v8?

@ChristianHeimke
Copy link

running webpack the first time can take a lot of time - on aws the build process inside the codepipeline took mostly ~2-4min. this would also the reason why your ssd is ~100% all the time... so maybe just wait for a longer time..? how long did you wait?

@giuseppealbrizio
Copy link

I created a project using

npx create-strapi-app my-project --quickstart

created a Dockerfile:

FROM strapi/base

WORKDIR /srv/app

COPY ./package.json ./
COPY ./yarn.lock ./

RUN yarn install

COPY . .

ENV NODE_ENV production

RUN yarn build

EXPOSE 1337

CMD ["yarn", "start"]

Now i'm trying to build the Docker Image, but it stucks always when building the webpack.

When I manually start yarn build in the container, then i can see that it's stuck at 90% processing chunk assets.

My container has 4GB Ram and 2 cpus attached. I can see that its using 100% SSD Read the whole time.

Do you have any suggestions?

I had this issue running Docker on a M1 chip. Later I added platform to the Dockerfile and also if it took more than 560 seconds it worked. I also used strapi/base instead of strapi/base:14-alpine

This fix worked for me:

FROM --platform=linux/amd64 strapi/base as base

WORKDIR /usr/src/app
#COPY ["package.json", "yarn.lock", "./"]
EXPOSE 1337

FROM base as builder
COPY ["package.json", "yarn.lock", "./"]
RUN yarn install
COPY . /usr/src/app
RUN yarn build

FROM base as release
ENV NODE_ENV=production
USER node
COPY --chown=node:node --from=builder /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=builder /usr/src/app/build ./build
COPY --chown=node:node . /usr/src/app
CMD ["yarn", "start"]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants