diff --git a/Dockerfile b/Dockerfile index ef16b9a..8a77e6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,58 @@ -FROM node:14 as servidor_mapas +# --- STAGE 1: Build & Setup stage --- +# Use the specific base image you require (Node 16 with Bullseye) +FROM node:16-bullseye AS build +WORKDIR /app -WORKDIR /usr/src/app +# Install necessary system dependencies (Python/Pip/other libs) +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + python3 python3-pip \ + # Add any other required build dependencies here + && rm -rf /var/lib/apt/lists/* -COPY package.json ./ -COPY tsconfig.json ./ +# Install Python packages +RUN pip3 install --no-cache-dir numpy pillow lxml fastapi -COPY ./src ./src -COPY ./prisma ./prisma -COPY ./@types ./@types +# Create necessary directories +RUN mkdir -p /app/assets/xml /app/assets/maps /app/assets/thumbs /app/uploads -RUN npm install --force + +# Install Node dependencies +COPY package*.json ./ +COPY prisma ./prisma +# 'npm ci --omit=dev' is excellent for production +RUN npm ci --omit=dev || npm install --force + +# Generate Prisma client RUN npm run prisma:gen + +# Build the application (e.g., TypeScript compilation) +COPY . . RUN npm run build -ENV DATABASE_URL="mysql://root:@Cj08310799@127.0.0.1:3306/servidor_mapas" -ENV PORT=8888 +# --- STAGE 2: Production Run stage --- +# Use a smaller/more secure runtime if possible (e.g., Node 16 slim/alpine, but careful with native modules) +# Stick to the same base for maximum compatibility since we installed system libs +FROM node:16-bullseye +WORKDIR /ena-map-server-back + +# Install *only* runtime dependencies if necessary (e.g., python/pip/libs needed at runtime) +# Re-install system packages necessary for runtime: +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + python3 python3-pip \ + # Add any other required runtime dependencies here + && rm -rf /var/lib/apt/lists/* +RUN pip3 install --no-cache-dir numpy pillow lxml fastapi + +# Copy only the necessary files from the build stage +# Note: /app is the build directory, /ena-map-server-back is the final working directory +COPY --from=build /app /ena-map-server-back + +EXPOSE 8888 -EXPOSE 80 -EXPOSE 443 -EXPOSE 8080 +# Set environment variables (optional, better in docker-compose) +# ENV NODE_ENV production +# The final production start command CMD ["npm", "start"] \ No newline at end of file diff --git a/assets/img/map (1)-1766977582409.png b/assets/img/map (1)-1766977582409.png new file mode 100644 index 0000000..4d70eeb Binary files /dev/null and b/assets/img/map (1)-1766977582409.png differ diff --git a/assets/img/map (1)-1766978529628.png b/assets/img/map (1)-1766978529628.png new file mode 100644 index 0000000..4d70eeb Binary files /dev/null and b/assets/img/map (1)-1766978529628.png differ diff --git a/assets/img/mapt-1766960559749-(4)-1766967448738-1766978680765.png b/assets/img/mapt-1766960559749-(4)-1766967448738-1766978680765.png new file mode 100644 index 0000000..4d70eeb Binary files /dev/null and b/assets/img/mapt-1766960559749-(4)-1766967448738-1766978680765.png differ diff --git a/assets/img/mapt-1766966462030-1766976673081.png b/assets/img/mapt-1766966462030-1766976673081.png new file mode 100644 index 0000000..4d70eeb Binary files /dev/null and b/assets/img/mapt-1766966462030-1766976673081.png differ diff --git a/assets/img/testenovo-1766976961441.png b/assets/img/testenovo-1766976961441.png new file mode 100644 index 0000000..e6f43b6 Binary files /dev/null and b/assets/img/testenovo-1766976961441.png differ diff --git a/assets/xml/map-(1)-1766978529628.xml b/assets/xml/map-(1)-1766978529628.xml new file mode 100644 index 0000000..70a0783 --- /dev/null +++ b/assets/xml/map-(1)-1766978529628.xml @@ -0,0 +1,136 @@ +5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,3.1,3.1,3.1,3.1,3.1,3.1,3.1,3.1 + +,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,3.1,3.1,3.1,3.1,3.1,3.1,3.1,3.1 + +,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,3.1,3.1,3.1,3.1,3.1,3.1,3.1,3.1 + +,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0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1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + \ No newline at end of file diff --git a/example.env b/example.env index 9e50176..874dff2 100644 --- a/example.env +++ b/example.env @@ -1,2 +1,2 @@ -DATABASE_URL=mysql://root:root@localhost:3306/servidor_mapas +DATABASE_URL=mysql://admin:Cefet@2025!@172.22.0.20:3306/servidor_mapas JWT_SECRET=abcd1234-ab12-ba12-1212-123456789abc \ No newline at end of file diff --git a/src/server.ts b/src/server.ts index b0a62b1..2607e14 100644 --- a/src/server.ts +++ b/src/server.ts @@ -65,7 +65,7 @@ export default class Server { origin: '*', }), ); - this.express.use('/image/', express.static('./assets/img')); +this.express.use('/image', express.static(path.join(process.cwd(), 'assets', 'img'))); dotenv.config(); } diff --git a/src/services/MapService.ts b/src/services/MapService.ts index 2f9f32d..4c4fbd9 100644 --- a/src/services/MapService.ts +++ b/src/services/MapService.ts @@ -4,7 +4,7 @@ import { CrudService } from './CrudService'; import { scriptReader } from '../utils/scriptReader'; import fs from 'fs'; import path from 'path'; -import { groupMapRepositoryByIdMap } from '../repository/GroupMapRepository'; +import { groupMapRepositoryByIdMap } from '../repository/GroupMapRepository'; import { userMapRepository } from '../repository/UserMapRepository'; class MapService extends CrudService { @@ -17,7 +17,7 @@ class MapService extends CrudService { } - async saveXmlFile(data: any) { + async saveXmlFile(data: any) { const pathName = path.resolve( __dirname, '../../', @@ -31,11 +31,11 @@ class MapService extends CrudService { return await scriptReader.convertXmlToJson(data); } - async deleteOldFileXml(data: any) { + async deleteOldFileXml(fileName: string) { const pathName = path.resolve( __dirname, '../../', - `assets/xml/${data.fileName.toLowerCase().replace(' ', '-')}.xml`, + `assets/xml/${fileName.toLowerCase().replace(' ', '-')}.xml`, ); fs.unlinkSync(pathName); @@ -47,12 +47,12 @@ class MapService extends CrudService { url: data.url, } - if(data.new_file === 'true') { - this.deleteOldFileXml(data.last_file_name) - this.saveXmlFile({ name: data.files[0].name, file: data.files[0] }) + if (data.new_file === 'true' && data.last_file_name) { + this.deleteOldFileXml(data.last_file_name); + this.saveXmlFile({ name: data.files[0].name, file: data.files[0] }) const mapJson = await this.convertXmlFile({ name: data.files[0].name, minify: true, file: data.files[0] }); - if(!mapJson) { + if (!mapJson) { throw new Error('Failed to convert JSON'); } @@ -62,7 +62,7 @@ class MapService extends CrudService { return mapRepository.update(id, newData); - + } override async create(data: CreateMapConvert): Promise { @@ -72,19 +72,19 @@ class MapService extends CrudService { id_owner: parseInt(`${data.id_owner}`), } - this.saveXmlFile({ name: data.files[0].name, file: data.files[0] }) - const mapJson = await this.convertXmlFile({ name: data.files[0].name, minify: true, file: data.files[0] }); + this.saveXmlFile({ name: data.files[0].name, file: data.files[0] }) + const mapJson = await this.convertXmlFile({ name: data.files[0].name, minify: true, file: data.files[0] }); - if(!mapJson) { - throw new Error('Failed to convert JSON'); - } + if (!mapJson) { + throw new Error('Failed to convert JSON'); + } newData.tag = JSON.stringify(mapJson); newData.thumb_url = data.files[0].name; - + return mapRepository.create(newData); } - + override async delete(id:number):Promise { const mapSelected = await mapRepository.getById(id); @@ -103,7 +103,7 @@ class MapService extends CrudService { const mapResponse = await mapRepository.getById(idMapa); if (mapResponse) { - + const pathName = path.resolve( __dirname, '../../', @@ -159,13 +159,13 @@ class MapService extends CrudService { } } - + async findAllPaged(page: string, limit: string, search: string): Promise { const users = await mapRepository.getAllPaged(page, limit, search); const count = await mapRepository.countAll(); const take = limit ? Number(limit) : users.length; - return { data: users, limit: take, page: Number(page), count}; + return { data: users, limit: take, page: Number(page), count }; } }