Add compose e dockerfile

This commit is contained in:
LeoMortari
2025-11-03 11:59:34 -03:00
parent 0f2c051eb9
commit b455acea46
6 changed files with 71 additions and 27 deletions

View File

@@ -1,7 +1,23 @@
node_modules node_modules
yarn.lock
package-lock.json
generated generated
dist dist
docker-compose.yml
Dockerfile
.gitignore
.github .github
.vscode .vscode
.idea
.git
*.md
.env
.env.local
.env.*.local
.env.example
.env.exemple
npm-debug.log*
yarn-debug.log*
yarn-error.log*
coverage
.prettierrc
.eslintrc.js
.eslint*

5
.env.example Normal file
View File

@@ -0,0 +1,5 @@
NODE_ENV=production
PORT=3000
DATABASE_URL="postgresql://username:password@postgres:5432/clipperia?schema=public"
KEYCLOAK_URL="https://auth.clipperia.com.br"
YOUTUBE_API_URL="https://your-youtube-api-url.com"

View File

@@ -1,4 +0,0 @@
DATABASE_URL="postgresql://username:password@ip_server:port/database?schema=public"
KEYCLOAK_URL="https://auth.clipperia.com.br"
YOUTUBE_API_URL="https://totally-real-dingo.ngrok-free.app"
GEMINI_API_KEY="GEMINI API KEY"

View File

@@ -1,20 +1,45 @@
FROM node:22-alpine FROM node:24-alpine AS builder
WORKDIR /app WORKDIR /app
COPY package.json ./ COPY package.json ./
RUN npm install -g pnpm
RUN pnpm install
COPY prisma ./prisma/ COPY prisma ./prisma/
RUN yarn install
COPY . .
RUN yarn build
ENV KEYCLOAK_URL=http://keycloak:8080
RUN npx prisma generate RUN npx prisma generate
COPY nest-cli.json tsconfig.json tsconfig.build.json ./
COPY src ./src
RUN pnpm build
RUN echo "=== Verificando build ===" && \
ls -la dist/ && \
test -f dist/main.js && \
echo "✓ Build concluído com sucesso!"
FROM node:24-alpine
WORKDIR /app
RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --prod
COPY prisma ./prisma/
RUN npx prisma generate
COPY --from=builder /app/dist ./dist
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000 EXPOSE 3000
CMD ["yarn", "start:prod"] CMD ["node", "dist/main.js"]

View File

@@ -1,18 +1,20 @@
services: services:
clipperia-api: api:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
no_cache: true
ports: ports:
- '3050:3000' - '1010:3000'
container_name: clipperia-api container_name: clipperia-api
environment: environment:
NODE_ENV: development NODE_ENV: production
KEYCLOAK_URL: http://keycloak:8080 KEYCLOAK_URL: http://keycloak:8080
DATABASE_URL: postgresql://leolitas:L@l321321321@postgres:5432/clipperia?schema=public DATABASE_URL: postgresql://leolitas:L@l321321321@postgres:5432/clipperia?schema=public
networks: YOUTUBE_API_URL: https://totally-real-dingo.ngrok-free.app
- dokploy-network # networks:
# - dokploy-network
networks: # networks:
dokploy-network: # dokploy-network:
external: true # external: true

View File

@@ -11,7 +11,7 @@
"start": "nest start", "start": "nest start",
"start:dev": "cross-env NODE_ENV=development nest start --watch", "start:dev": "cross-env NODE_ENV=development nest start --watch",
"start:debug": "cross-env NODE_ENV=development nest start --debug --watch", "start:debug": "cross-env NODE_ENV=development nest start --debug --watch",
"start:prod": "node dist/main", "start:prod": "node dist/main.js",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest", "test": "jest",
"test:watch": "jest --watch", "test:watch": "jest --watch",