Maagan-Michael / net-n

Micro ISP management system
https://maagan-michael.github.io/net-n/
MIT License
1 stars 2 forks source link

[Infra] UI Docker failure #10

Closed yarons closed 11 months ago

yarons commented 11 months ago

The following error appears:

 => [builder 6/7] WORKDIR /app/switch-manager-react                                                                                                                                                            0.0s
 => ERROR [builder 7/7] RUN npm run build                                                                                                                                                                      2.8s
------                                                                                                                                                                                                              
 > [builder 7/7] RUN npm run build:                                                                                                                                                                                 
0.442 
0.442 > switch-manager-react@0.1.0 build
0.442 > tsc && vite build
0.442 
2.746 src/api/mutations/upsertFullConnection.tsx(26,7): error TS2322: Type 'any[]' is not assignable to type 'never[]'.
2.746   Type 'any' is not assignable to type 'never'.
2.747 src/api/mutations/upsertFullConnection.tsx(27,7): error TS2322: Type 'any[]' is not assignable to type 'never[]'.
2.747 src/components/inputs/datePicker.tsx(8,20): error TS2307: Cannot find module '@icons/carret.svg?react' or its corresponding type declarations.
2.747 src/components/inputs/toggle.tsx(3,22): error TS2307: Cannot find module '@icons/toggleOn.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/connection/form/TechnicalSection.tsx(10,18): error TS2307: Cannot find module '@icons/lock.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/connection/form/TechnicalSection.tsx(11,20): error TS2307: Cannot find module '@icons/lock-open.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/connection/form/TechnicalSection.tsx(13,17): error TS2307: Cannot find module '@icons/gps.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/connection/form/index.tsx(9,19): error TS2307: Cannot find module '@icons/cross.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/table/header/TableHeaderCell.tsx(3,20): error TS2307: Cannot find module '@icons/carret.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/table/header/index.tsx(1,19): error TS2307: Cannot find module '@icons/house.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/table/header/index.tsx(2,21): error TS2307: Cannot find module '@icons/network.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/table/header/index.tsx(3,22): error TS2307: Cannot find module '@icons/customer.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/table/header/index.tsx(4,22): error TS2307: Cannot find module '@icons/calandar.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/table/row.tsx(3,26): error TS2307: Cannot find module '@icons/computer.svg?react' or its corresponding type declarations.
2.747 src/routes/connections/table/row.tsx(4,22): error TS2307: Cannot find module '@icons/ethernet.svg?react' or its corresponding type declarations.
2.747 src/routes/dashboard/navigation/SearchBar.tsx(4,20): error TS2307: Cannot find module '@icons/search.svg?react' or its corresponding type declarations.
2.747 src/routes/dashboard/navigation/SearchBar.tsx(94,17): error TS2322: Type '{ sm?: boolean | undefined; icon?: FunctionComponent<SVGAttributes<SVGElement>> | undefined; text?: string | undefined; onError?: ReactEventHandler<...> | undefined; ... 266 more ...; disabled: boolean; }' is not assignable to type 'IntrinsicAttributes & IconFilterElemProps'.
2.747   Property 'disabled' does not exist on type 'IntrinsicAttributes & IconFilterElemProps'.
2.747 src/routes/dashboard/navigation/filters.tsx(6,22): error TS2307: Cannot find module '@icons/customer.svg?react' or its corresponding type declarations.
2.747 src/routes/dashboard/navigation/filters.tsx(7,19): error TS2307: Cannot find module '@icons/house.svg?react' or its corresponding type declarations.
2.748 src/routes/dashboard/navigation/filters.tsx(8,21): error TS2307: Cannot find module '@icons/network.svg?react' or its corresponding type declarations.
2.748 src/routes/dashboard/navigation/filters.tsx(9,22): error TS2307: Cannot find module '@icons/computer.svg?react' or its corresponding type declarations.
2.748 src/routes/dashboard/navigation/filters.tsx(10,22): error TS2307: Cannot find module '@icons/asterisk.svg?react' or its corresponding type declarations.
2.748 src/routes/dashboard/navigation/index.tsx(4,24): error TS2307: Cannot find module '@icons/search.svg?react' or its corresponding type declarations.
2.748 src/routes/dashboard/navigation/index.tsx(5,19): error TS2307: Cannot find module '@icons/cross.svg?react' or its corresponding type declarations.
------
Dockerfile:8
--------------------
   6 |     COPY . .
   7 |     WORKDIR /app/switch-manager-react
   8 | >>> RUN npm run build 
   9 |     # Stage 2: Create the production image
  10 |     FROM nginx:mainline-alpine-slim
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 2

When I'm trying to build with the following Dockerfile:

# Stage 1: Build the React app
FROM node:lts-slim as builder
WORKDIR /app
COPY switch-manager-react/package*.json ./
RUN npm install --legacy-peer-deps
COPY . .
WORKDIR /app/switch-manager-react
RUN npm run build 
# Stage 2: Create the production image
FROM nginx:mainline-alpine-slim
COPY --from=builder /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
nathanschwarz commented 11 months ago

removed tsc from the npm run build, it was left from the react-create-app scripts. It should work as expected now