diff --git a/Dockerfile b/Dockerfile index 4fd8893..5382704 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,10 @@ WORKDIR /tmp ## Build back: ## ###################################################################################### -FROM builder AS buildBack -COPY back/pom.xml /tmp -COPY back/src /tmp/src/ +FROM builder AS build_back +COPY back/pom.xml ./ +COPY back/Formatter.xml ./ +COPY back/src ./src/ RUN mvn clean compile assembly:single ###################################################################################### @@ -27,27 +28,44 @@ RUN mvn clean compile assembly:single ## Build front: ## ###################################################################################### -FROM builder AS buildFront +FROM builder AS dependency_front RUN echo "@kangaroo-and-rabbit:registry=https://gitea.atria-soft.org/api/packages/kangaroo-and-rabbit/npm/" > /root/.npmrc ADD front/package.json \ - front/karma.conf.js \ - front/protractor.conf.js \ - /tmp/ + front/pnpm-lock.yaml \ + ./ +ADD front/src/theme ./src/theme # install and cache app dependencies -RUN pnpm install +RUN pnpm install --prod=false -ADD front/e2e \ - front/tsconfig.json \ - front/tslint.json \ - front/angular.json \ - /tmp/ -ADD front/src /tmp/src +############################################################### +## Install sources +############################################################### +FROM dependency_front AS load_sources_front -# generate build -RUN ng build --output-path=dist --configuration=production --base-href=/karusic/ --deploy-url=/karusic/ +# JUST to get the vertion of the application and his sha... +COPY front/build.js \ + front/version.txt \ + front/tsconfig.json \ + front/tsconfig.node.json \ + front/vite.config.mts \ + front/index.html \ + ./ +COPY front/public ./public +COPY front/src ./src + +#We are not in prod mode ==> we need to overwrite the production env. +ARG env=front/.env.production +COPY ${env} .env + +############################################################### +## Build the sources +############################################################### +FROM load_sources_front AS build_front +# build in bundle mode all the application +RUN pnpm static:build ###################################################################################### ## @@ -70,8 +88,8 @@ RUN apk add --no-cache wget ENV LANG=C.UTF-8 -COPY --from=buildBack /tmp/out/maven/*.jar /application/application.jar -COPY --from=buildFront /tmp/dist /application/front/ +COPY --from=build_back /tmp/out/maven/*.jar /application/application.jar +COPY --from=build_front /tmp/dist /application/front/ WORKDIR /application/ diff --git a/back/pom.xml b/back/pom.xml index 8a20dba..cb48cb1 100644 --- a/back/pom.xml +++ b/back/pom.xml @@ -20,7 +20,7 @@ kangaroo-and-rabbit archidata - 0.13.1-SNAPSHOT + 0.14.2 org.slf4j diff --git a/front/.env.production b/front/.env.production new file mode 100644 index 0000000..2f9d0d5 --- /dev/null +++ b/front/.env.production @@ -0,0 +1,2 @@ +# URL for database connection +VITE_API_BASE_URL=api/ diff --git a/front/package.json b/front/package.json index 851231a..5b12fe3 100644 --- a/front/package.json +++ b/front/package.json @@ -17,6 +17,7 @@ "test": "vitest run", "test:watch": "vitest watch", "build": "tsc && vite build", + "static:build": "node build.js && pnpm build", "dev": "vite", "pretty": "prettier -w .", "lint": "pnpm tsc --noEmit", diff --git a/front/src/components/form/FormCovers.tsx b/front/src/components/form/FormCovers.tsx index bd05f16..4a92620 100644 --- a/front/src/components/form/FormCovers.tsx +++ b/front/src/components/form/FormCovers.tsx @@ -1,30 +1,21 @@ import { DragEventHandler, - ReactNode, RefObject, - forwardRef, - useEffect, - useState, } from 'react'; import { Box, BoxProps, Center, - Icon, Image, Wrap, WrapItem, } from '@chakra-ui/react'; -import { relative } from 'path'; import { - MdCheckCircle, - MdClear, MdHighlightOff, MdUploadFile, } from 'react-icons/md'; -import { ProxyResource } from '@/back-api'; import { FormGroup } from '@/components/form/FormGroup'; import { UseFormidableReturn } from '@/components/form/Formidable'; import { DataUrlAccess } from '@/utils/data-url-access'; @@ -37,8 +28,8 @@ export type DragNdropProps = { }; export const DragNdrop = ({ - onFilesSelected = () => {}, - onUriSelected = () => {}, + onFilesSelected = () => { }, + onUriSelected = () => { }, width = '100px', height = '100px', }: DragNdropProps) => { @@ -49,7 +40,8 @@ export const DragNdrop = ({ onFilesSelected(newFiles); } }; - const handleDrop = (event: DragEvent) => { + const handleDrop = (eventInput: any) => { + const event = eventInput as DragEvent; event.preventDefault(); const droppedFiles = event.dataTransfer?.files; console.log('drop ...' + droppedFiles?.length); @@ -139,9 +131,9 @@ export const FormCovers = ({ form, variableName, ref, - onFilesSelected = () => {}, - onUriSelected = () => {}, - onRemove = () => {}, + onFilesSelected = () => { }, + onUriSelected = () => { }, + onRemove = () => { }, ...rest }: FormCoversProps) => { const urls = diff --git a/front/src/service/ServiceContext.tsx b/front/src/service/ServiceContext.tsx index ece2de3..45e974f 100644 --- a/front/src/service/ServiceContext.tsx +++ b/front/src/service/ServiceContext.tsx @@ -25,74 +25,47 @@ export type ServiceContextType = { activePlaylist: ActivePlaylistServiceProps; }; + +const emptyStore = { + data: [], + isLoading: true, + get: (_value, _key) => { + console.error('!!! WTF !!!'); + return undefined; + }, + gets: (_value, _key) => { + console.error('!!! WTF !!!'); + return []; + }, + error: undefined, + update: (request: Promise<{ id: number; artists: number[]; track?: number | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; deleted?: boolean | undefined; name?: string | undefined; description?: string | undefined; covers?: string[] | undefined; genderId?: number | undefined; albumId?: number | undefined; dataId?: string | undefined; }>, key?: string): void => { + console.error('!!! WTF !!!'); + }, + remove: (id: number | string, request: Promise, key?: string): void => { + console.error('!!! WTF !!!'); + } +} + export const ServiceContext = createContext({ session: { - setToken: (token: string) => {}, - clearToken: () => {}, + setToken: (token: string) => { }, + clearToken: () => { }, hasReadRight: (part: RightPart) => false, hasWriteRight: (part: RightPart) => false, state: SessionState.NO_USER, getRestConfig: getRestConfig, }, track: { - store: { - data: [], - isLoading: true, - get: (_value, _key) => { - console.error('!!! WTF !!!'); - return undefined; - }, - gets: (_value, _key) => { - console.error('!!! WTF !!!'); - return []; - }, - error: undefined, - }, + store: emptyStore, }, artist: { - store: { - data: [], - isLoading: true, - get: (_value, _key) => { - console.error('!!! WTF !!!'); - return undefined; - }, - gets: (_value, _key) => { - console.error('!!! WTF !!!'); - return []; - }, - error: undefined, - }, + store: emptyStore, }, album: { - store: { - data: [], - isLoading: true, - get: (_value, _key) => { - console.error('!!! WTF !!!'); - return undefined; - }, - gets: (_value, _key) => { - console.error('!!! WTF !!!'); - return []; - }, - error: undefined, - }, + store: emptyStore, }, gender: { - store: { - data: [], - isLoading: true, - get: (_value, _key) => { - console.error('!!! WTF !!!'); - return undefined; - }, - gets: (_value, _key) => { - console.error('!!! WTF !!!'); - return []; - }, - error: undefined, - }, + store: emptyStore, }, activePlaylist: { playTrackList: [], diff --git a/front/src/utils/sha512.ts b/front/src/utils/sha512.ts index cab4a47..95d9fac 100644 --- a/front/src/utils/sha512.ts +++ b/front/src/utils/sha512.ts @@ -333,7 +333,7 @@ export function sha512(str) { H[7] = safe_add_2(h, H[7]); } - let binarray = []; + const binarray: any = []; for (let i = 0; i < H.length; i++) { binarray.push(H[i].highOrder); binarray.push(H[i].lowOrder);