LemmyNet / lemmy-ui

The official web app for lemmy.
https://join-lemmy.org/
GNU Affero General Public License v3.0
901 stars 336 forks source link

lemmy-ui docker buid failed to reproduce. #2005

Open themsay opened 1 year ago

themsay commented 1 year ago

Requirements

Summary

Lemmy-UI docker build is failing. I have no idea why, if anybody know better way to build from repo directly.

Build output: $ cd lemmy-ui/ $ docker build .

[+] Building 6.4s (20/28)                                                            docker:default
 => [internal] load build definition from Dockerfile                                           0.0s
 => => transferring dockerfile: 1.28kB                                                         0.0s
 => [internal] load .dockerignore                                                              0.1s
 => => transferring context: 58B                                                               0.0s
 => [internal] load metadata for docker.io/library/node:alpine                                 0.9s
 => [internal] load metadata for docker.io/library/node:20.2-alpine                            0.0s
 => [auth] library/node:pull token for registry-1.docker.io                                    0.0s
 => CANCELED [runner 1/4] FROM docker.io/library/node:alpine@sha256:49f1c207f12f52e7dd4878e1c  5.2s
 => => resolve docker.io/library/node:alpine@sha256:49f1c207f12f52e7dd4878e1c10a911c05ed7f534  0.1s
 => => sha256:49f1c207f12f52e7dd4878e1c10a911c05ed7f534e6526b879ddc6dabed058f 1.43kB / 1.43kB  0.0s
 => => sha256:11087abe911baf2fd7e34192f4598bf7e438239e9914f5b7ecda5fb5a7b1a2d 1.16kB / 1.16kB  0.0s
 => => sha256:b03abf062002a807e59156a589d885b5f9f42079aabedcdb3c8a96d2c5b0440 6.73kB / 6.73kB  0.0s
 => => sha256:03c6b1d5f51e007010caff4b91c0bd2ff365543d2f9e8ab12f71925fd66f267 2.34MB / 2.34MB  0.5s
 => => sha256:d4fe5e85fcdfc5a4c18d844da93d600853b47f6509fab11d5fa221654f69a3f6 448B / 448B     0.4s
 => => sha256:11d56374b943b8215bd95cab04acee38eb6035ce74ad20a4af4c5d03f2007 35.65MB / 49.45MB  5.3s
 => [builder  1/18] FROM docker.io/library/node:20.2-alpine                                    0.0s
 => [internal] load build context                                                              0.1s
 => => transferring context: 20.30kB                                                           0.1s
 => CACHED [builder  2/18] RUN apk update && apk add curl yarn python3 build-base gcc wget gi  0.0s
 => CACHED [builder  3/18] RUN curl -sf https://gobinaries.com/tj/node-prune | sh              0.0s
 => CACHED [builder  4/18] WORKDIR /usr/src/app                                                0.0s
 => CACHED [builder  5/18] COPY package.json yarn.lock ./                                      0.0s
 => CACHED [builder  6/18] RUN yarn --production --prefer-offline --pure-lockfile              0.0s
 => CACHED [builder  7/18] COPY generate_translations.js   tsconfig.json   webpack.config.js   0.0s
 => CACHED [builder  8/18] COPY lemmy-translations lemmy-translations                          0.0s
 => CACHED [builder  9/18] COPY src src                                                        0.0s
 => CACHED [builder 10/18] COPY .git .git                                                      0.0s
 => CACHED [builder 11/18] RUN echo "export const VERSION = '$(git describe --tag)';" > "src/  0.0s
 => CACHED [builder 12/18] RUN yarn --production --prefer-offline                              0.0s
 => ERROR [builder 13/18] RUN NODE_OPTIONS="--max-old-space-size=8192" yarn build:prod         5.0s
------                                                                                              
 > [builder 13/18] RUN NODE_OPTIONS="--max-old-space-size=8192" yarn build:prod:                    
1.514 yarn run v1.22.19                                                                             
1.780 $ yarn clean && node generate_translations.js                                                 
3.188 $ yarn run rimraf dist                                                                        
4.130 $ /usr/src/app/node_modules/.bin/rimraf dist                                                  
4.544 /usr/src/app/generate_translations.js:7
4.544   files.forEach(filename => {
4.544         ^
4.544 
4.544 TypeError: Cannot read properties of undefined (reading 'forEach')
4.544     at /usr/src/app/generate_translations.js:7:9
4.544     at FSReqCallback.oncomplete (node:fs:188:23)
4.544 
4.544 Node.js v20.2.0
4.571 error Command failed with exit code 1.
4.576 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
Dockerfile:30
--------------------
  28 |     
  29 |     RUN yarn --production --prefer-offline
  30 | >>> RUN NODE_OPTIONS="--max-old-space-size=8192" yarn build:prod
  31 |     
  32 |     # Prune the image
--------------------
ERROR: failed to solve: process "/bin/sh -c NODE_OPTIONS=\"--max-old-space-size=8192\" yarn build:prod" did not complete successfully: exit code: 1

Can anyone with better idea show me what could be the issue causing the build to fail?

Steps to Reproduce

  1. clone the repo
  2. $ cd lemmy-ui/
  3. $ docker build .

Technical Details

Build on Linux Debian terminal.

Lemmy Instance Version

main

Lemmy Instance URL

No response

brihuang99 commented 1 year ago

i'm having a similar issue... running ./docker_update.sh in the main lemmy directory builds everything just fine though.

damoun commented 1 year ago

You must init and update the submodule before the docker build.

git submodule init && git submodule update --remote