OcrStep bileşeninde BASE_URL kontrolü güncellendi; Dockerfile ve docker-compose.yml dosyaları eklendi; geliştirme ve üretim ortamları için yapılandırmalar oluşturuldu.
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# syntax=docker/dockerfile:1.6
|
||||
|
||||
ARG NODE_VERSION=20
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine AS base
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
|
||||
FROM base AS dev
|
||||
ENV NODE_ENV=development
|
||||
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5173"]
|
||||
|
||||
FROM base AS build
|
||||
ARG VITE_API_BASE_URL=http://localhost:4000
|
||||
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
|
||||
RUN npm run build
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine AS prod
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
COPY package.json package-lock.json ./
|
||||
COPY --from=base /app/node_modules ./node_modules
|
||||
COPY --from=build /app/dist ./dist
|
||||
EXPOSE 4173
|
||||
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4173"]
|
||||
62
docker-compose.yml
Normal file
62
docker-compose.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
services:
|
||||
frontend-dev:
|
||||
build:
|
||||
context: .
|
||||
target: dev
|
||||
environment:
|
||||
- VITE_API_BASE_URL=http://localhost:4000
|
||||
ports:
|
||||
- "5173:5173"
|
||||
volumes:
|
||||
- .:/app
|
||||
- frontend_dev_node_modules:/app/node_modules
|
||||
depends_on:
|
||||
- backend-dev
|
||||
profiles:
|
||||
- imgpub-app-dev
|
||||
|
||||
backend-dev:
|
||||
build:
|
||||
context: ./server
|
||||
target: dev
|
||||
environment:
|
||||
- PORT=4000
|
||||
- CLIENT_ORIGIN=http://localhost:5173
|
||||
ports:
|
||||
- "4000:4000"
|
||||
volumes:
|
||||
- ./server:/app
|
||||
- backend_dev_node_modules:/app/node_modules
|
||||
profiles:
|
||||
- imgpub-app-dev
|
||||
|
||||
frontend-prod:
|
||||
build:
|
||||
context: .
|
||||
target: prod
|
||||
args:
|
||||
VITE_API_BASE_URL: http://localhost:4000
|
||||
environment:
|
||||
- VITE_API_BASE_URL=http://localhost:4000
|
||||
ports:
|
||||
- "4173:4173"
|
||||
depends_on:
|
||||
- backend-prod
|
||||
profiles:
|
||||
- imgpub-app
|
||||
|
||||
backend-prod:
|
||||
build:
|
||||
context: ./server
|
||||
target: prod
|
||||
environment:
|
||||
- PORT=4000
|
||||
- CLIENT_ORIGIN=http://localhost:4173
|
||||
ports:
|
||||
- "4000:4000"
|
||||
profiles:
|
||||
- imgpub-app
|
||||
|
||||
volumes:
|
||||
frontend_dev_node_modules:
|
||||
backend_dev_node_modules:
|
||||
1
public/tesseract/worker.min.js.map
Normal file
1
public/tesseract/worker.min.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"worker.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
||||
19
server/Dockerfile
Normal file
19
server/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
# syntax=docker/dockerfile:1.6
|
||||
|
||||
ARG NODE_VERSION=20
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine AS base
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
|
||||
FROM base AS dev
|
||||
ENV NODE_ENV=development
|
||||
EXPOSE 4000
|
||||
CMD ["npm", "run", "dev"]
|
||||
|
||||
FROM base AS prod
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 4000
|
||||
CMD ["node", "index.js"]
|
||||
@@ -27,8 +27,11 @@ const OcrStep = () => {
|
||||
const abortRef = useRef(false);
|
||||
|
||||
const assetBase = useMemo(() => {
|
||||
const base = import.meta.env.BASE_URL ?? '/';
|
||||
return base.endsWith('/') ? base.slice(0, -1) : base;
|
||||
const rawBase = import.meta.env.BASE_URL ?? '/';
|
||||
if (rawBase === '.' || rawBase === './' || rawBase === '/') {
|
||||
return '';
|
||||
}
|
||||
return rawBase.endsWith('/') ? rawBase.slice(0, -1) : rawBase;
|
||||
}, []);
|
||||
const workerRef = useRef(null);
|
||||
const [workerReady, setWorkerReady] = useState(false);
|
||||
@@ -54,15 +57,18 @@ const OcrStep = () => {
|
||||
const initWorker = async () => {
|
||||
setWorkerReady(false);
|
||||
try {
|
||||
const worker = await Tesseract.createWorker(
|
||||
'tur', // Dil doğrudan belirt
|
||||
1, // OEM level (LSTM)
|
||||
{
|
||||
const workerOptions = {
|
||||
workerPath: paths.workerPath,
|
||||
corePath: paths.corePath,
|
||||
langPath: paths.langPath,
|
||||
logger: isDev ? (m) => console.log('Tesseract:', m) : undefined,
|
||||
},
|
||||
};
|
||||
if (isDev) {
|
||||
workerOptions.logger = (m) => console.log('Tesseract:', m);
|
||||
}
|
||||
const worker = await Tesseract.createWorker(
|
||||
'tur', // Dil doğrudan belirt
|
||||
1, // OEM level (LSTM)
|
||||
workerOptions,
|
||||
);
|
||||
|
||||
// Türkçe karakter tanımını iyileştir
|
||||
|
||||
Reference in New Issue
Block a user