gohorsejobs/backoffice/Dockerfile
Tiago Yamamoto 9ee9f6855c feat: implementar múltiplas features
Backend:
- Password reset flow (forgot/reset endpoints, tokens table)
- Profile management (PUT /users/me, skills, experience, education)
- Tickets system (CRUD, messages, stats)
- Activity logs (list, stats)
- Document validator (CNPJ, CPF, EIN support)
- Input sanitizer (XSS prevention)
- Full-text search em vagas (plainto_tsquery)
- Filtros avançados (location, salary, workMode)
- Ordenação (date, salary, relevance)

Frontend:
- Forgot/Reset password pages
- Candidate profile edit page
- Sanitize utilities (sanitize.ts)

Backoffice:
- TicketsModule proxy
- ActivityLogsModule proxy
- Dockerfile otimizado (multi-stage, non-root, healthcheck)

Migrations:
- 013: Profile fields to users
- 014: Password reset tokens
- 015: Tickets table
- 016: Activity logs table
2025-12-27 11:19:47 -03:00

54 lines
1.4 KiB
Docker

# ================================================
# Stage 1: Build
# ================================================
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files first for better layer caching
COPY package.json package-lock.json ./
# Install all dependencies (including dev for build)
RUN npm ci --legacy-peer-deps
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Prune dev dependencies for smaller production image
RUN npm prune --production
# ================================================
# Stage 2: Production Runtime
# ================================================
FROM node:20-alpine AS production
# Add non-root user for security
RUN addgroup -g 1001 -S nodejs \
&& adduser -S nestjs -u 1001
WORKDIR /app
# Copy only production artifacts
COPY --from=builder --chown=nestjs:nodejs /app/dist ./dist
COPY --from=builder --chown=nestjs:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=nestjs:nodejs /app/package.json ./
# Set environment
ENV NODE_ENV=production
ENV PORT=3001
# Use non-root user
USER nestjs
# Expose port
EXPOSE 3001
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3001/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))" || exit 1
# Start application
CMD ["node", "dist/main.js"]