[DEV] build docker and correct some typing

This commit is contained in:
Edouard DUPIN 2024-09-15 17:53:20 +02:00
parent a24484b5f9
commit 5eba6d32b6
7 changed files with 75 additions and 89 deletions

View File

@ -17,9 +17,10 @@ WORKDIR /tmp
## Build back: ## Build back:
## ##
###################################################################################### ######################################################################################
FROM builder AS buildBack FROM builder AS build_back
COPY back/pom.xml /tmp COPY back/pom.xml ./
COPY back/src /tmp/src/ COPY back/Formatter.xml ./
COPY back/src ./src/
RUN mvn clean compile assembly:single RUN mvn clean compile assembly:single
###################################################################################### ######################################################################################
@ -27,27 +28,44 @@ RUN mvn clean compile assembly:single
## Build front: ## 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 RUN echo "@kangaroo-and-rabbit:registry=https://gitea.atria-soft.org/api/packages/kangaroo-and-rabbit/npm/" > /root/.npmrc
ADD front/package.json \ ADD front/package.json \
front/karma.conf.js \ front/pnpm-lock.yaml \
front/protractor.conf.js \ ./
/tmp/ ADD front/src/theme ./src/theme
# install and cache app dependencies # install and cache app dependencies
RUN pnpm install RUN pnpm install --prod=false
ADD front/e2e \ ###############################################################
## Install sources
###############################################################
FROM dependency_front AS load_sources_front
# JUST to get the vertion of the application and his sha...
COPY front/build.js \
front/version.txt \
front/tsconfig.json \ front/tsconfig.json \
front/tslint.json \ front/tsconfig.node.json \
front/angular.json \ front/vite.config.mts \
/tmp/ front/index.html \
ADD front/src /tmp/src ./
COPY front/public ./public
COPY front/src ./src
# generate build #We are not in prod mode ==> we need to overwrite the production env.
RUN ng build --output-path=dist --configuration=production --base-href=/karusic/ --deploy-url=/karusic/ 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 ENV LANG=C.UTF-8
COPY --from=buildBack /tmp/out/maven/*.jar /application/application.jar COPY --from=build_back /tmp/out/maven/*.jar /application/application.jar
COPY --from=buildFront /tmp/dist /application/front/ COPY --from=build_front /tmp/dist /application/front/
WORKDIR /application/ WORKDIR /application/

View File

@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>kangaroo-and-rabbit</groupId> <groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId> <artifactId>archidata</artifactId>
<version>0.13.1-SNAPSHOT</version> <version>0.14.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>

2
front/.env.production Normal file
View File

@ -0,0 +1,2 @@
# URL for database connection
VITE_API_BASE_URL=api/

View File

@ -17,6 +17,7 @@
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest watch", "test:watch": "vitest watch",
"build": "tsc && vite build", "build": "tsc && vite build",
"static:build": "node build.js && pnpm build",
"dev": "vite", "dev": "vite",
"pretty": "prettier -w .", "pretty": "prettier -w .",
"lint": "pnpm tsc --noEmit", "lint": "pnpm tsc --noEmit",

View File

@ -1,30 +1,21 @@
import { import {
DragEventHandler, DragEventHandler,
ReactNode,
RefObject, RefObject,
forwardRef,
useEffect,
useState,
} from 'react'; } from 'react';
import { import {
Box, Box,
BoxProps, BoxProps,
Center, Center,
Icon,
Image, Image,
Wrap, Wrap,
WrapItem, WrapItem,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { relative } from 'path';
import { import {
MdCheckCircle,
MdClear,
MdHighlightOff, MdHighlightOff,
MdUploadFile, MdUploadFile,
} from 'react-icons/md'; } from 'react-icons/md';
import { ProxyResource } from '@/back-api';
import { FormGroup } from '@/components/form/FormGroup'; import { FormGroup } from '@/components/form/FormGroup';
import { UseFormidableReturn } from '@/components/form/Formidable'; import { UseFormidableReturn } from '@/components/form/Formidable';
import { DataUrlAccess } from '@/utils/data-url-access'; import { DataUrlAccess } from '@/utils/data-url-access';
@ -37,8 +28,8 @@ export type DragNdropProps = {
}; };
export const DragNdrop = ({ export const DragNdrop = ({
onFilesSelected = () => {}, onFilesSelected = () => { },
onUriSelected = () => {}, onUriSelected = () => { },
width = '100px', width = '100px',
height = '100px', height = '100px',
}: DragNdropProps) => { }: DragNdropProps) => {
@ -49,7 +40,8 @@ export const DragNdrop = ({
onFilesSelected(newFiles); onFilesSelected(newFiles);
} }
}; };
const handleDrop = (event: DragEvent) => { const handleDrop = (eventInput: any) => {
const event = eventInput as DragEvent;
event.preventDefault(); event.preventDefault();
const droppedFiles = event.dataTransfer?.files; const droppedFiles = event.dataTransfer?.files;
console.log('drop ...' + droppedFiles?.length); console.log('drop ...' + droppedFiles?.length);
@ -139,9 +131,9 @@ export const FormCovers = ({
form, form,
variableName, variableName,
ref, ref,
onFilesSelected = () => {}, onFilesSelected = () => { },
onUriSelected = () => {}, onUriSelected = () => { },
onRemove = () => {}, onRemove = () => { },
...rest ...rest
}: FormCoversProps) => { }: FormCoversProps) => {
const urls = const urls =

View File

@ -25,74 +25,47 @@ export type ServiceContextType = {
activePlaylist: ActivePlaylistServiceProps; 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<void>, key?: string): void => {
console.error('!!! WTF !!!');
}
}
export const ServiceContext = createContext<ServiceContextType>({ export const ServiceContext = createContext<ServiceContextType>({
session: { session: {
setToken: (token: string) => {}, setToken: (token: string) => { },
clearToken: () => {}, clearToken: () => { },
hasReadRight: (part: RightPart) => false, hasReadRight: (part: RightPart) => false,
hasWriteRight: (part: RightPart) => false, hasWriteRight: (part: RightPart) => false,
state: SessionState.NO_USER, state: SessionState.NO_USER,
getRestConfig: getRestConfig, getRestConfig: getRestConfig,
}, },
track: { track: {
store: { store: emptyStore,
data: [],
isLoading: true,
get: (_value, _key) => {
console.error('!!! WTF !!!');
return undefined;
},
gets: (_value, _key) => {
console.error('!!! WTF !!!');
return [];
},
error: undefined,
},
}, },
artist: { artist: {
store: { store: emptyStore,
data: [],
isLoading: true,
get: (_value, _key) => {
console.error('!!! WTF !!!');
return undefined;
},
gets: (_value, _key) => {
console.error('!!! WTF !!!');
return [];
},
error: undefined,
},
}, },
album: { album: {
store: { store: emptyStore,
data: [],
isLoading: true,
get: (_value, _key) => {
console.error('!!! WTF !!!');
return undefined;
},
gets: (_value, _key) => {
console.error('!!! WTF !!!');
return [];
},
error: undefined,
},
}, },
gender: { gender: {
store: { store: emptyStore,
data: [],
isLoading: true,
get: (_value, _key) => {
console.error('!!! WTF !!!');
return undefined;
},
gets: (_value, _key) => {
console.error('!!! WTF !!!');
return [];
},
error: undefined,
},
}, },
activePlaylist: { activePlaylist: {
playTrackList: [], playTrackList: [],

View File

@ -333,7 +333,7 @@ export function sha512(str) {
H[7] = safe_add_2(h, H[7]); H[7] = safe_add_2(h, H[7]);
} }
let binarray = []; const binarray: any = [];
for (let i = 0; i < H.length; i++) { for (let i = 0; i < H.length; i++) {
binarray.push(H[i].highOrder); binarray.push(H[i].highOrder);
binarray.push(H[i].lowOrder); binarray.push(H[i].lowOrder);