Compare commits

..

2 Commits

Author SHA1 Message Date
darroyo b20b33bf9b Merge pull request 'cambio jenkins' (#2) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #2
2026-03-24 01:39:28 +00:00
darroyo ad21d7fb6a Merge pull request 'develop' (#1) from develop into main
Personal/recall/pipeline/head There was a failure building this commit
Reviewed-on: #1
2026-03-24 01:31:16 +00:00
9 changed files with 27 additions and 72 deletions
+9 -23
View File
@@ -1,9 +1,7 @@
# Stage 1: Dependencies # Stage 1: Dependencies
FROM node:20-slim AS deps FROM node:20-alpine AS deps
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apk add --no-cache libc6-compat
openssl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
@@ -12,53 +10,41 @@ COPY package.json package-lock.json* ./
RUN npm ci RUN npm ci
# Stage 2: Build # Stage 2: Build
FROM node:20-slim AS builder FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
ENV DATABASE_URL="file:./dev.db"
RUN npx prisma generate RUN npx prisma generate
RUN npm run build RUN npm run build
# Stage 3: Production # Stage 3: Production
FROM node:20-slim AS runner FROM node:20-alpine AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN addgroup --system --gid 1001 nodejs
openssl \ RUN adduser --system --uid 1001 nextjs
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/prisma ./prisma COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=builder /app/prisma/schema.prisma /app/schema.prisma COPY --from=builder /app/prisma/schema.prisma /app/schema.prisma
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh USER nextjs
EXPOSE 3000 EXPOSE 3000
ENV PORT=3000 ENV PORT=3000
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
ENV DATABASE_URL="file:/app/data/dev.db" ENV DATABASE_URL="file:./dev.db"
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["node", "server.js"] CMD ["node", "server.js"]
Vendored
+9 -8
View File
@@ -6,7 +6,7 @@ pipeline {
} }
environment { environment {
URL_REGISTRY = 'gitea.danielarroyo.cl' URL_REGISTRY = 'gitea.danielarroyo.cl'
PROJECT = 'darroyo' PROJECT = 'home-projects'
REMOTE_USER = 'root' REMOTE_USER = 'root'
REMOTE_HOST = '10.5.0.116' REMOTE_HOST = '10.5.0.116'
REMOTE_PATH = '/compose' REMOTE_PATH = '/compose'
@@ -39,12 +39,13 @@ pipeline {
try { try {
sh """ sh """
ls -la ls -la
ls -la src || echo "Directorio src no encontrado" #ls -la src || echo "Directorio src no encontrado"
ls -la src/main/docker || echo "Directorio src/main/docker no encontrado" #ls -la src/main/docker || echo "Directorio src/main/docker no encontrado"
cat .dockerignore || echo ".dockerignore no encontrado" #cat .dockerignore || echo ".dockerignore no encontrado"
docker -v docker -v
docker build \ docker build \
-t ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} . -t ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} \
-f .
docker tag ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} \ docker tag ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:${BUILD_NUMBER} \
${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:latest ${URL_REGISTRY}/${PROJECT}/${NAME_SERVICE}:latest
""" """
@@ -85,13 +86,13 @@ services:
- "traefik.http.routers.${NAME_SERVICE}.rule=Host(`recall.vodorod.cl`)" - "traefik.http.routers.${NAME_SERVICE}.rule=Host(`recall.vodorod.cl`)"
environment: environment:
- TZ=America/Santiago - TZ=America/Santiago
- DATABASE_URL=file:/app/data/dev.db - DATABASE_URL=file:./data/dev.db
volumes: volumes:
- ./data:/app/data - ./data:/app/data
networks: networks:
- homelab-net - homelab-net
mem_limit: 512m mem_limit: 32m
mem_reservation: 256m mem_reservation: 16m
restart: unless-stopped restart: unless-stopped
networks: networks:
homelab-net: homelab-net:
-4
View File
@@ -248,7 +248,3 @@ src/
└── types/ └── types/
└── note.ts └── note.ts
``` ```
nueva prueba
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -8,5 +8,5 @@ services:
volumes: volumes:
- ./data:/app/data - ./data:/app/data
environment: environment:
- DATABASE_URL=file:/app/data/dev.db - DATABASE_URL=file:./data/dev.db
restart: unless-stopped restart: unless-stopped
-25
View File
@@ -1,25 +0,0 @@
#!/bin/bash
set -e
cd /app
echo "Checking database..."
# Ensure data directory exists with proper permissions
mkdir -p /app/data
chmod 777 /app/data
# Run db push (creates/updates database schema)
# If it fails due to OOM but DB exists, continue anyway
./node_modules/prisma/build/index.js db push --skip-generate || {
exit_code=$?
if [ -f /app/data/dev.db ]; then
echo "db push failed (code $exit_code) but database exists, continuing..."
else
echo "db push failed and database does not exist"
exit $exit_code
fi
}
echo "Starting application..."
exec "$@"
+7 -8
View File
@@ -105,22 +105,21 @@ export async function POST(req: NextRequest) {
const createdAt = parseDate((item as { createdAt?: string }).createdAt) const createdAt = parseDate((item as { createdAt?: string }).createdAt)
const updatedAt = parseDate((item as { updatedAt?: string }).updatedAt) const updatedAt = parseDate((item as { updatedAt?: string }).updatedAt)
const itemWithId = item as { id?: string }
if (itemWithId.id) { if (item.id) {
const existing = await tx.note.findUnique({ where: { id: itemWithId.id } }) const existing = await tx.note.findUnique({ where: { id: item.id } })
if (existing) { if (existing) {
await tx.note.update({ await tx.note.update({
where: { id: itemWithId.id }, where: { id: item.id },
data: { ...noteData, createdAt, updatedAt }, data: { ...noteData, createdAt, updatedAt },
}) })
await tx.noteTag.deleteMany({ where: { noteId: itemWithId.id } }) await tx.noteTag.deleteMany({ where: { noteId: item.id } })
processed++ processed++
} else { } else {
await tx.note.create({ await tx.note.create({
data: { data: {
...noteData, ...noteData,
id: itemWithId.id, id: item.id,
createdAt, createdAt,
updatedAt, updatedAt,
creationSource: 'import', creationSource: 'import',
@@ -151,8 +150,8 @@ export async function POST(req: NextRequest) {
processed++ processed++
} }
const noteId = itemWithId.id const noteId = item.id
? (await tx.note.findUnique({ where: { id: itemWithId.id } }))?.id ? (await tx.note.findUnique({ where: { id: item.id } }))?.id
: (await tx.note.findFirst({ where: { title: item.title } }))?.id : (await tx.note.findFirst({ where: { title: item.title } }))?.id
if (noteId && tags.length > 0) { if (noteId && tags.length > 0) {
+1 -1
View File
@@ -33,7 +33,7 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ id:
throw new ValidationError(result.error.issues) throw new ValidationError(result.error.issues)
} }
const { tags, id: _, ...noteData } = result.data const { tags, ...noteData } = result.data
const existingNote = await prisma.note.findUnique({ where: { id } }) const existingNote = await prisma.note.findUnique({ where: { id } })
if (!existingNote) { if (!existingNote) {
-2
View File
@@ -1,8 +1,6 @@
import { Dashboard } from '@/components/dashboard' import { Dashboard } from '@/components/dashboard'
import { getDashboardData } from '@/lib/dashboard' import { getDashboardData } from '@/lib/dashboard'
export const dynamic = 'force-dynamic'
export default async function HomePage() { export default async function HomePage() {
const data = await getDashboardData(6) const data = await getDashboardData(6)