strapi-community / strapi-tool-dockerize

Easy add support for docker to your strapi project
MIT License
556 stars 35 forks source link

Stuck building admin panel #104

Closed alimoli closed 11 months ago

alimoli commented 11 months ago

🐛 Bug Report

I used your interactive command to dockerize my application.

🤷‍♀️ What did you do

Then, I am trying to build the production image for the architecture linux/amd64.

docker build --platform linux/amd64 -t xxx/yyy-strapi:0.0.4 -f Dockerfile.prod .

It produces the following output:

[+] Building 1006.0s (14/18)                                                                                                                                                                                                                                                                                                                                                                            docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 99B                                                                                                                                                                                                                                                                                                                                                                                       0.0s
 => [internal] load build definition from Dockerfile.prod                                                                                                                                                                                                                                                                                                                                                              0.0s
 => => transferring dockerfile: 845B                                                                                                                                                                                                                                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/node:18-alpine                                                                                                                                                                                                                                                                                                                                                      0.9s
 => [build 1/8] FROM docker.io/library/node:18-alpine@sha256:b1a0356f7d6b86c958a06949d3db3f7fb27f95f627aa6157cb98bc65c801efa2                                                                                                                                                                                                                                                                                          2.8s
 => => resolve docker.io/library/node:18-alpine@sha256:b1a0356f7d6b86c958a06949d3db3f7fb27f95f627aa6157cb98bc65c801efa2                                                                                                                                                                                                                                                                                                0.0s
 => => sha256:0f158788f409a5decd9495205daf4aa17df26d8219d6dc12acab5949342866fe 40.24MB / 40.24MB                                                                                                                                                                                                                                                                                                                       1.6s
 => => sha256:f028dff98271801e449c3ebac94a319851128c0ec687e13e00a68b2d98ec4700 2.34MB / 2.34MB                                                                                                                                                                                                                                                                                                                         0.2s
 => => sha256:18f25c33705ddc3351cc4893fdc0a38405bdd0741643798918fa2b0146fd5a9d 451B / 451B                                                                                                                                                                                                                                                                                                                             0.3s
 => => sha256:b1a0356f7d6b86c958a06949d3db3f7fb27f95f627aa6157cb98bc65c801efa2 1.43kB / 1.43kB                                                                                                                                                                                                                                                                                                                         0.0s
 => => sha256:8842b060b01af71c082cee310b428a2d825e940d9fd9e450e05d726aea66a480 1.16kB / 1.16kB                                                                                                                                                                                                                                                                                                                         0.0s
 => => sha256:f3776b60850deec9eb1da7746fa20b3f000bf153408dc896d6606704c83f948d 7.14kB / 7.14kB                                                                                                                                                                                                                                                                                                                         0.0s
 => => extracting sha256:0f158788f409a5decd9495205daf4aa17df26d8219d6dc12acab5949342866fe                                                                                                                                                                                                                                                                                                                              1.0s
 => => extracting sha256:f028dff98271801e449c3ebac94a319851128c0ec687e13e00a68b2d98ec4700                                                                                                                                                                                                                                                                                                                              0.0s
 => => extracting sha256:18f25c33705ddc3351cc4893fdc0a38405bdd0741643798918fa2b0146fd5a9d                                                                                                                                                                                                                                                                                                                              0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 6.76kB                                                                                                                                                                                                                                                                                                                                                                                    0.0s
 => [build 2/8] RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev > /dev/null 2>&1                                                                                                                                                                                                                                                                                    9.1s
 => [stage-1 2/7] RUN apk add --no-cache vips-dev                                                                                                                                                                                                                                                                                                                                                                      7.0s
 => [stage-1 3/7] WORKDIR /opt/                                                                                                                                                                                                                                                                                                                                                                                        0.0s
 => [build 3/8] WORKDIR /opt/                                                                                                                                                                                                                                                                                                                                                                                          0.0s
 => [build 4/8] COPY package.json yarn.lock ./                                                                                                                                                                                                                                                                                                                                                                         0.0s
 => [build 5/8] RUN yarn config set network-timeout 600000 -g && yarn install --production                                                                                                                                                                                                                                                                                                                            65.8s
 => [build 6/8] WORKDIR /opt/app                                                                                                                                                                                                                                                                                                                                                                                       0.0s 
 => [build 7/8] COPY . .                                                                                                                                                                                                                                                                                                                                                                                               0.0s 
 => [build 8/8] RUN yarn build                                                                                                                                                                                                                                                                                                                                                                                       653.9s 
 => => # [INFO] Including the following ENV variables as part of the JS bundle:                                                                                                                                                                                                                                                                                                                                             
 => => #     - ADMIN_PATH                                                                                                                                                                                                                                                                                                                                                                                                   
 => => #     - STRAPI_ADMIN_BACKEND_URL                                                                                                                                                                                                                                                                                                                                                                                     
 => => #     - STRAPI_TELEMETRY_DISABLED                                                                                                                                                                                                                                                                                                                                                                                    
 => => # ✔ Building build context (175ms)                                                                                                                                                                                                                                                                                                                                                                                  
 => => # - Building admin panel     

If I change the platform with linux/arm64, the build works. ⚠️

⛔️ Error log

The building gets stuck and I am not able to get any error. If I stop the command, I get: ERROR: failed to solve: Canceled: context canceled

🙇‍♀️ Expected behavior/code

I expect to build the application using the provided Dockerfile for the platform linux/amd64.

👩‍💻 Environment

Eventyret commented 11 months ago

Not sure if it gets stuck or not. It might depend on how long you have to wait. The build for strapi can take up several minutes

alimoli commented 11 months ago

Not sure if it gets stuck or not. It might depend on how long you have to wait. The build for strapi can take up several minutes

Thank you for your quick reply. I think 16 minutes is very much considering the linux/arm64 architecture takes less that one minute.

[+] Building 15.9s (20/20) FINISHED   

Anyway, I have left it for a while now and we are over 15 hours.

I have just given a try with docker buildx and I am getting: docker buildx build --platform linux/amd64 -t xxx/yyy-strapi:0.0.4 -f Dockerfile.prod .

Dockerfile.prod:9
--------------------
   7 |     WORKDIR /opt/
   8 |     COPY package.json yarn.lock ./
   9 | >>> RUN yarn config set network-timeout 600000 -g && yarn install --production
  10 |     ENV PATH /opt/node_modules/.bin:$PATH
  11 |     WORKDIR /opt/app
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c yarn config set network-timeout 600000 -g && yarn install --production" did not complete successfully: exit code: 1

Anyway I think my issues is related to this https://github.com/docker/for-mac/issues/6356. I will close this issue.