[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:
##
######################################################################################
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/

View File

@ -20,7 +20,7 @@
<dependency>
<groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.2</version>
</dependency>
<dependency>
<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:watch": "vitest watch",
"build": "tsc && vite build",
"static:build": "node build.js && pnpm build",
"dev": "vite",
"pretty": "prettier -w .",
"lint": "pnpm tsc --noEmit",

View File

@ -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 =

View File

@ -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<void>, key?: string): void => {
console.error('!!! WTF !!!');
}
}
export const ServiceContext = createContext<ServiceContextType>({
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: [],

View File

@ -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);