spliit-app / spliit

Free and Open Source Alternative to Splitwise. Share expenses with your friends and family.
https://spliit.app
MIT License
1.16k stars 184 forks source link

Dockerfile does not build in version 1.9.0 #199

Open simone-viozzi opened 3 months ago

simone-viozzi commented 3 months ago

Hi, I was trying to update my deployment to latest version but the looks like that the Dockerfile does not build.

First, it did not find the ./next.config.js file, and looks like it was renamed in ./next.config.mjs, that was an easy fix.

But still fails to build.

Those are the docker build logs:

Click to get the full log ```text ❯ docker compose build --progress=plain --no-cache --progress is a global compose flag, better use `docker compose --progress xx build ... #0 building with "default" instance using docker driver #1 [app internal] load build definition from Dockerfile #1 transferring dockerfile: 1.21kB done #1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1) #1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 27) #1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 36) #1 DONE 0.0s #2 [app internal] load metadata for docker.io/library/node:21-alpine #2 DONE 0.5s #3 [app internal] load .dockerignore #3 transferring context: 2B done #3 DONE 0.0s #4 [app runtime-deps 1/5] FROM docker.io/library/node:21-alpine@sha256:78c45726ea205bbe2f23889470f03b46ac988d14b6d813d095e2e9909f586f93 #4 DONE 0.0s #5 [app runtime-deps 2/5] WORKDIR /usr/app #5 CACHED #6 [app internal] load build context #6 transferring context: 10.40kB done #6 DONE 0.0s #7 [app base 3/10] COPY ./package.json ./package-lock.json ./next.config.mjs ./tsconfig.json ./reset.d.ts ./tailwind.config.js ./postcss.config.js ./ #7 DONE 0.6s #8 [app base 4/10] COPY ./scripts ./scripts #8 DONE 0.1s #9 [app base 5/10] COPY ./prisma ./prisma #9 DONE 0.1s #10 [app base 6/10] RUN apk add --no-cache openssl && npm ci --ignore-scripts && npx prisma generate #10 0.650 fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz #10 0.853 fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz #10 1.073 (1/3) Upgrading libcrypto3 (3.3.0-r2 -> 3.3.1-r3) #10 1.264 (2/3) Upgrading libssl3 (3.3.0-r2 -> 3.3.1-r3) #10 1.479 (3/3) Installing openssl (3.3.1-r3) #10 1.505 Executing busybox-1.36.1-r28.trigger #10 1.564 OK: 11 MiB in 17 packages #10 16.21 #10 16.21 added 1037 packages, and audited 1038 packages in 14s #10 16.21 #10 16.21 143 packages are looking for funding #10 16.21 run `npm fund` for details #10 16.21 #10 16.21 found 0 vulnerabilities #10 16.21 npm notice #10 16.21 npm notice New minor version of npm available! 10.5.0 -> 10.8.2 #10 16.21 npm notice Changelog: #10 16.21 npm notice Run `npm install -g npm@10.8.2` to update! #10 16.21 npm notice #10 17.46 Prisma schema loaded from prisma/schema.prisma #10 17.82 #10 17.82 ✔ Generated Prisma Client (v5.9.1) to ./node_modules/@prisma/client in 78ms #10 17.82 #10 17.82 Start using Prisma Client in Node.js (See: https://pris.ly/d/client) #10 17.82 ``` #10 17.82 import { PrismaClient } from '@prisma/client' #10 17.82 const prisma = new PrismaClient() #10 17.82 ``` #10 17.82 or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate) #10 17.82 ``` #10 17.82 import { PrismaClient } from '@prisma/client/edge' #10 17.82 const prisma = new PrismaClient() #10 17.82 ``` #10 17.82 #10 17.82 See other ways of importing Prisma Client: http://pris.ly/d/importing-client #10 17.82 #10 17.82 ┌─────────────────────────────────────────────────────────────┐ #10 17.82 │ Deploying your app to serverless or edge functions? │ #10 17.82 │ Try Prisma Accelerate for connection pooling and caching. │ #10 17.82 │ https://pris.ly/cli/accelerate │ #10 17.82 └─────────────────────────────────────────────────────────────┘ #10 17.82 #10 DONE 17.9s #11 [app base 7/10] COPY ./src ./src #11 DONE 1.6s #12 [app base 8/10] COPY scripts/build.env .env #12 DONE 0.2s #13 [app base 9/10] RUN npm run build #13 0.920 #13 0.920 > spliit2@0.1.0 build #13 0.920 > next build #13 0.920 #13 1.562 ▲ Next.js 14.2.5 #13 1.562 - Environments: .env #13 1.562 #13 1.575 Creating an optimized production build ... #13 16.09 Failed to compile. #13 16.09 #13 16.09 ./src/i18n.ts #13 16.09 Module not found: Can't resolve '../messages' #13 16.09 #13 16.09 https://nextjs.org/docs/messages/module-not-found #13 16.09 #13 16.09 Import trace for requested module: #13 16.09 ./src/components/locale-switcher.tsx #13 16.09 #13 16.09 ./src/i18n.ts #13 16.09 Module not found: Can't resolve '../messages' #13 16.09 #13 16.09 https://nextjs.org/docs/messages/module-not-found #13 16.09 #13 16.09 Import trace for requested module: #13 16.09 ./node_modules/next-intl/dist/esm/server/react-server/getConfig.js #13 16.09 ./node_modules/next-intl/dist/esm/server/react-server/getFormatter.js #13 16.09 ./node_modules/next-intl/dist/esm/server.react-server.js #13 16.09 ./src/app/layout.tsx #13 16.09 #13 16.09 #13 16.09 > Build failed because of webpack errors #13 ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1 ------ > [app base 9/10] RUN npm run build: 16.09 https://nextjs.org/docs/messages/module-not-found 16.09 16.09 Import trace for requested module: 16.09 ./node_modules/next-intl/dist/esm/server/react-server/getConfig.js 16.09 ./node_modules/next-intl/dist/esm/server/react-server/getFormatter.js 16.09 ./node_modules/next-intl/dist/esm/server.react-server.js 16.09 ./src/app/layout.tsx 16.09 16.09 16.09 > Build failed because of webpack errors ------ failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1 ```

thank you!

bitgroestl commented 3 months ago

The problem was that the messages directory wasn't copied to the docker image. My pull request (#200) fixes that.