Compare commits

..

14 Commits

Author SHA1 Message Date
6e7e50dc16 chore: Remove file. 2026-02-14 00:49:57 -03:00
e0a61a0374 feat: Add Docker configuration for the Next.js frontend, enabling standalone output and next-intl integration. 2026-02-14 00:48:45 -03:00
aeedb3f5a0 fix(deps): update react to 19.2.4 to fix CVE-2025-55182, add docker workflow
Some checks failed
Build and Push Docker Images / build-and-push (push) Has been cancelled
2026-02-14 00:21:50 -03:00
4c426fb68c fix: add Dockerfile and docker-compose configuration for backend and frontend services
Some checks failed
Build and Deploy to Production / deploy (push) Has been cancelled
2025-11-22 08:01:00 -03:00
d8feffe9f4 fix: add BackendPort configuration to support dynamic backend port setting
Some checks failed
Build and Deploy to Production / deploy (push) Has been cancelled
2025-10-30 00:11:07 -03:00
f37142903a fix: configure backend port and simplify application arguments in ecosystem config 2025-10-29 23:38:50 -03:00
28be7d1e1c fix: add caching for Next.js build to improve deployment efficiency 2025-10-29 22:45:49 -03:00
4b047e0157 fix: update rsync commands in deployment workflow to improve file synchronization 2025-10-29 22:22:44 -03:00
fe03b3d4da fix: enhance file sync process in deployment workflow with detailed output and progress tracking 2025-10-29 22:14:41 -03:00
fdbb54a6b3 fix: ensure backend appsettings are included in published output and sync ecosystem files for PM2 2025-10-29 21:44:29 -03:00
0d29ba4da0 fix: update file sync paths in deployment workflow to ensure correct directory structure 2025-10-29 21:33:20 -03:00
d40cb543e9 fix: update backend project references in deployment workflow 2025-10-29 21:26:58 -03:00
41b86eccf0 fix: update backend solution references in deployment script and project descriptions 2025-10-29 21:23:08 -03:00
81e915d155 fix: update deploy workflow to improve caching and streamline environment file creation 2025-10-29 21:04:08 -03:00
14 changed files with 599 additions and 346 deletions

View File

@@ -1,93 +0,0 @@
name: Build and Deploy to Production
run-name: Deploying commit ${{ gitea.sha_short }} by @${{ gitea.actor }}
on:
push:
branches:
- main
jobs:
deploy:
runs-on: website-deploy-runner
env:
DOTNET_INSTALL_DIR: "$HOME/.dotnet"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET 8 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
cache: true
dotnet-solution: 'backend/JoaoLoureiro.Portfolio.slnx'
- name: Create Backend appsettings.Production.json
run: |
echo "Creating backend appsettings.Production.json file..."
# This creates the JSON file by mapping your Gitea secrets/vars
# to the structure you provided.
cat <<EOF > backend/appsettings.Production.json
{
"SmtpSettings": {
"Host": "${{ vars.SMTP_HOST }}",
"Port": ${{ vars.SMTP_PORT }},
"User": "${{ secrets.SMTP_USER }}",
"Pass": "${{ secrets.SMTP_PASS }}",
"FromEmail": "${{ vars.SMTP_FROM_EMAIL }}",
"ReceivingEmail": "${{ vars.YOUR_RECEIVING_EMAIL }}"
},
"CorsOrigins": "${{ vars.FRONTEND_URL }}"
}
EOF
- name: Create Frontend .env.local file
run: |
echo "Creating frontend .env.local file..."
cd frontend
echo "NEXT_PUBLIC_GITHUB_URL=${{ vars.NEXT_PUBLIC_GITHUB_URL }}" >> .env.local
echo "NEXT_PUBLIC_LINKEDIN_URL=${{ vars.NEXT_PUBLIC_LINKEDIN_URL }}" >> .env.local
- name: Cache Dependencies
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
frontend/node_modules
frontend/.next/cache
key: ${{ runner.os }}-${{ hashFiles('**/*.csproj') }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-
- name: Install Dependencies and Build
run: |
echo "Restoring backend NuGet packages..."
dotnet restore backend
echo "Building and publishing backend..."
# This compiles the app and places the output in the 'publish' folder
dotnet publish backend --configuration Release --output ./publish
echo "Installing frontend dependencies..."
cd frontend && npm install
echo "Building frontend application..."
npm run build
- name: Sync Files to Production Directory
run: |
# Sync the published backend from the './publish' directory
rsync -a --delete ./publish/ /var/www/website.joaoloureiro.dev.br/
# Sync the built frontend from the 'frontend' directory
rsync -a --delete ./frontend/.next /var/www/website.joaoloureiro.dev.br/
rsync -a --delete ./frontend/public /var/www/website.joaoloureiro.dev.br/
rsync -a ./frontend/package.json /var/www/website.joaoloureiro.dev.br/
rsync -a ./frontend/ecosystem.config.js /var/www/website.joaoloureiro.dev.br/
- name: Restart Applications with PM2
run: |
# This command on your server should handle restarting both processes
# Ensure your PM2 ecosystem file now has entries for both the .NET app
# and the Next.js app.
restart-portfolio

View File

@@ -1,3 +1,4 @@
# Ignore common files that shouldn't be in the container
**/.classpath
**/.dockerignore
**/.env
@@ -13,16 +14,23 @@
**/*.jfm
**/azds.yaml
**/bin
**/obj
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
**/.idea
**/.vs
**/.vscode
**/*.user
**/*.suo
**/*.userosscache
**/*.sln.docstates
# Include all .csproj files - they are needed for the build
!**/*.csproj
!**/*.sln
!**/.gitignore
!.git/HEAD
!.git/config

47
backend/Dockerfile Normal file
View File

@@ -0,0 +1,47 @@
# Build stage - using .NET SDK
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy project files first for better layer caching
COPY ["*.sln", "./"]
COPY ["JoaoLoureiro.Portfolio.Api/*.csproj", "JoaoLoureiro.Portfolio.Api/"]
COPY ["JoaoLoureiro.Portfolio.Application/*.csproj", "JoaoLoureiro.Portfolio.Application/"]
COPY ["JoaoLoureiro.Portfolio.Domain/*.csproj", "JoaoLoureiro.Portfolio.Domain/"]
COPY ["JoaoLoureiro.Portfolio.Infrastructure/*.csproj", "JoaoLoureiro.Portfolio.Infrastructure/"]
# Restore dependencies
WORKDIR "/src/JoaoLoureiro.Portfolio.Api"
RUN dotnet restore
# Copy remaining source code
WORKDIR "/src"
COPY . .
# Build and publish
WORKDIR "/src/JoaoLoureiro.Portfolio.Api"
RUN dotnet publish -c Release -o /app/publish
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
# curl used by docker-compose healthcheck
RUN apt-get update \
&& apt-get install -y curl \
&& rm -rf /var/lib/apt/lists/*
# Configure logging to show in container logs
ENV ASPNETCORE_ENVIRONMENT=Development
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
ENV ASPNETCORE_URLS=http://+:3001
ENV ASPNETCORE_HTTP_PORT=3001
ENV ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
# Expose the port
EXPOSE 3001
# Copy published app
COPY --from=build /app/publish .
# Entry point with enhanced logging
ENTRYPOINT ["dotnet", "JoaoLoureiro.Portfolio.Api.dll"]

View File

@@ -15,6 +15,11 @@ using System.Net;
var builder = WebApplication.CreateBuilder(args);
if (builder.Configuration["BackendPort"] is { Length: > 0 } port && ushort.TryParse(port, out _))
{
builder.WebHost.UseUrls($"http://0.0.0.0:{port}");
}
builder.Host.UseSerilog((context, config) => config.ReadFrom.Configuration(context.Configuration));
builder.Services.AddProblemDetails();

View File

@@ -2,7 +2,8 @@
"apps": [{
"name": "portfolio-backend",
"script": "dotnet",
"args": "JoaoLoureiro.Portfolio.Api/bin/Release/net8.0/JoaoLoureiro.Portfolio.Api.dll",
"args": "JoaoLoureiro.Portfolio.Api.dll",
"cwd": "/var/www/website.joaoloureiro.dev.br/backend",
"instances": 1,
"autorestart": true,
"watch": false,

47
docker-compose.yml Normal file
View File

@@ -0,0 +1,47 @@
version: '3.8'
services:
# Backend Service
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: portfolio-backend
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:80
networks:
- traefik_network
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.portfolio-backend.rule=Host(`api.yourdomain.com`)"
- "traefik.http.routers.portfolio-backend.entrypoints=websecure"
- "traefik.http.services.portfolio-backend.loadbalancer.server.port=80"
- "traefik.docker.network=traefik_network"
- "traefik.http.routers.portfolio-backend.tls.certresolver=le"
- "traefik.http.routers.portfolio-backend.middlewares=auth@docker"
# Frontend Service
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: portfolio-frontend
environment:
- NEXT_PUBLIC_API_URL=https://api.yourdomain.com
networks:
- traefik_network
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.portfolio-frontend.rule=Host(`yourdomain.com`, `www.yourdomain.com`)"
- "traefik.http.routers.portfolio-frontend.entrypoints=websecure"
- "traefik.http.services.portfolio-frontend.loadbalancer.server.port=3000"
- "traefik.docker.network=traefik_network"
- "traefik.http.routers.portfolio-frontend.tls.certresolver=le"
- "traefik.http.routers.portfolio-frontend.middlewares=auth@docker"
networks:
traefik_network:
external: true # Using your existing Traefik network

11
frontend/.dockerignore Normal file
View File

@@ -0,0 +1,11 @@
node_modules
.next
.git
.gitignore
.env
.env.local
.env.production
README.md
Dockerfile
.dockerignore
npm-debug.log

56
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,56 @@
FROM node:20-alpine AS base
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json package-lock.json* ./
RUN npm ci
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT=3000
# set hostname to localhost
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]

View File

@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -1,7 +1,9 @@
import type { NextConfig } from "next";
import createNextIntlPlugin from 'next-intl/plugin';
const nextConfig: NextConfig = {};
const nextConfig: NextConfig = {
output: "standalone",
};
const withNextIntl = createNextIntlPlugin();
export default withNextIntl(nextConfig);

File diff suppressed because it is too large Load Diff

View File

@@ -11,11 +11,12 @@
"dependencies": {
"@heroicons/react": "^2.2.0",
"framer-motion": "^12.16.0",
"next": "15.3.3",
"next": "^15.5.6",
"next-auth": "^4.24.13",
"next-intl": "^4.1.0",
"react": "^19.0.0",
"react": "^19.2.4",
"react-country-flag": "^3.1.0",
"react-dom": "^19.0.0",
"react-dom": "^19.2.4",
"react-hot-toast": "^2.5.2",
"react-icons": "^5.5.0",
"react-type-animation": "^3.2.0"
@@ -31,4 +32,4 @@
"tailwindcss": "^4",
"typescript": "^5"
}
}
}

View File

@@ -23,7 +23,7 @@
"about": {
"title": "About Me",
"paragraph1": "I am a Full Stack Developer driven by a passion for building, automating, and scaling robust applications. My journey into technology began with a desire to understand how complex systems work, and it has evolved into a career dedicated to crafting elegant, high-performance solutions.",
"paragraph2": "With a strong foundation in the .NET and JavaScript ecosystems, I specialize in creating modern web applications using technologies like .NET, Angular, Next.js, React, and Node.js. However, my curiosity extends beyond code. As you can see from my Homelab project, I am deeply engaged with the full development lifecycle, including CI/CD, containerization with Docker, and infrastructure management.",
"paragraph2": "With a strong foundation in the .NET and JavaScript ecosystems, I specialize in creating modern web applications using technologies like .NET, Angular, Next.js, and React. However, my curiosity extends beyond code. As you can see from my Homelab project, I am deeply engaged with the full development lifecycle, including CI/CD, containerization with Docker, and infrastructure management.",
"paragraph3": "I thrive on challenges and am constantly exploring new technologies, from database administration with MariaDB and Redis to workflow automation with N8N and message queuing with RabbitMQ. This hands-on approach to DevOps and self-hosting allows me to build not just features, but resilient and scalable systems."
},
"skills": {
@@ -36,14 +36,14 @@
"projects": {
"title": "Projects I've Built",
"project_1_title": "Personal Portfolio",
"project_1_description": "The very site you are on now! A full-stack application built with Next.js, Tailwind CSS, and a Node.js backend to showcase my work and skills.",
"project_1_details": "This portfolio is a full-stack application designed to showcase my skills and projects. It features a modern, decoupled architecture with a Next.js frontend and a Node.js backend. The project is automatically deployed via Gitea Actions, with PM2 managing the processes on the server for zero-downtime restarts.",
"project_1_description": "The very site you are on now! A full-stack application built with Next.js, Tailwind CSS, and a .NET 8 backend to showcase my work and skills.",
"project_1_details": "This portfolio is a full-stack application designed to showcase my skills and projects. It features a modern, decoupled architecture with a Next.js frontend and a .NET 8 backend. The project is automatically deployed via Gitea Actions, with PM2 managing the processes on the server for zero-downtime restarts.",
"project_1_features_title": "Key Features:",
"project_1_features": [
"**Internationalization (i18n):** Fully translated in English and Portuguese with `next-intl`.",
"**Responsive Design:** Optimized for all devices using Tailwind CSS.",
"**Interactive UI:** Includes a theme switcher (dark/light mode) and toast notifications.",
"**Robust Backend:** An Express.js server handles contact form submissions securely using Nodemailer."
"**Robust Backend:** A .NET 8 API handles contact form submissions securely."
],
"project_2_title": "Homelab & DevOps Playground",
"project_2_description": "A self-hosted infrastructure running on Proxmox, showcasing a wide range of DevOps and backend services.",

View File

@@ -23,7 +23,7 @@
"about": {
"title": "Sobre Mim",
"paragraph1": "Sou um Desenvolvedor Full Stack movido pela paixão de construir, automatizar e escalar aplicações robustas. Minha jornada na tecnologia começou com o desejo de entender como sistemas complexos funcionam e evoluiu para uma carreira dedicada a criar soluções elegantes e de alta performance.",
"paragraph2": "Com uma base sólida nos ecossistemas .NET e JavaScript, minha especialidade é a criação de aplicações web modernas utilizando tecnologias como .NET, Angular, Next.js, React e Node.js. No entanto, minha curiosidade vai além do código. Como você pode ver no meu projeto de Homelab, estou profundamente envolvido com todo o ciclo de vida de desenvolvimento, incluindo CI/CD, conteinerização com Docker e gerenciamento de infraestrutura.",
"paragraph2": "Com uma base sólida nos ecossistemas .NET e JavaScript, minha especialidade é a criação de aplicações web modernas utilizando tecnologias como .NET, Angular, Next.js e React. No entanto, minha curiosidade vai além do código. Como você pode ver no meu projeto de Homelab, estou profundamente envolvido com todo o ciclo de vida de desenvolvimento, incluindo CI/CD, conteinerização com Docker e gerenciamento de infraestrutura.",
"paragraph3": "Eu prospero em desafios e estou constantemente explorando novas tecnologias, desde a administração de bancos de dados com MariaDB e Redis até a automação de fluxos de trabalho com N8N e filas de mensagens com RabbitMQ. Essa abordagem prática em DevOps e auto-hospedagem me permite construir não apenas funcionalidades, mas sistemas resilientes e escaláveis."
},
"skills": {
@@ -36,14 +36,14 @@
"projects": {
"title": "Projetos que Construí",
"project_1_title": "Portfólio Pessoal",
"project_1_description": "O próprio site em que você está agora! Uma aplicação full-stack construída com Next.js, Tailwind CSS e um backend Node.js para exibir meu trabalho e habilidades.",
"project_1_details": "Este portfólio é uma aplicação full-stack projetada para mostrar minhas habilidades e projetos. Possui uma arquitetura moderna e desacoplada, com um frontend em Next.js e um backend em Node.js. O projeto é implantado automaticamente via Gitea Actions, com o PM2 gerenciando os processos no servidor para reinicializações sem tempo de inatividade.",
"project_1_description": "O próprio site em que você está agora! Uma aplicação full-stack construída com Next.js, Tailwind CSS e um backend .NET 8 para exibir meu trabalho e habilidades.",
"project_1_details": "Este portfólio é uma aplicação full-stack projetada para mostrar minhas habilidades e projetos. Possui uma arquitetura moderna e desacoplada, com um frontend em Next.js e um backend em .NET 8. O projeto é implantado automaticamente via Gitea Actions, com o PM2 gerenciando os processos no servidor para reinicializações sem tempo de inatividade.",
"project_1_features_title": "Principais Características:",
"project_1_features": [
"**Internacionalização (i18n):** Totalmente traduzido para inglês e português com `next-intl`.",
"**Design Responsivo:** Otimizado para todos os dispositivos usando Tailwind CSS.",
"**UI Interativa:** Inclui um seletor de tema (modo claro/escuro) e notificações para feedback de formulários.",
"**Backend Robusto:** Um servidor Express.js lida com os envios do formulário de contato de forma segura usando o Nodemailer."
"**Backend Robusto:** Uma API .NET 8 lida com os envios do formulário de contato de forma segura usando o MailKit."
],
"project_2_title": "Homelab & Playground DevOps",
"project_2_description": "Uma infraestrutura auto-hospedada rodando em Proxmox, demonstrando uma vasta gama de serviços de DevOps e backend.",