Compare commits
12 Commits
dff77d42c6
...
v1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| aeedb3f5a0 | |||
| 4c426fb68c | |||
| d8feffe9f4 | |||
| f37142903a | |||
| 28be7d1e1c | |||
| 4b047e0157 | |||
| fe03b3d4da | |||
| fdbb54a6b3 | |||
| 0d29ba4da0 | |||
| d40cb543e9 | |||
| 41b86eccf0 | |||
| 81e915d155 |
@@ -1,93 +1,56 @@
|
||||
name: Build and Deploy to Production
|
||||
run-name: Deploying commit ${{ gitea.sha_short }} by @${{ gitea.actor }}
|
||||
name: Build and Push Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
branches: [ "main" ]
|
||||
tags: [ "v*" ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
build-and-push:
|
||||
runs-on: website-deploy-runner
|
||||
env:
|
||||
DOTNET_INSTALL_DIR: "$HOME/.dotnet"
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET 8 SDK
|
||||
uses: actions/setup-dotnet@v4
|
||||
- name: Log in to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
cache: true
|
||||
dotnet-solution: 'backend/JoaoLoureiro.Portfolio.slnx'
|
||||
registry: gitea.joaoloureiro.dev.br
|
||||
username: ${{ secrets.GITEA_USER }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- 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
|
||||
- name: Extract metadata (tags, labels) for Backend
|
||||
id: meta-backend
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
path: |
|
||||
~/.nuget/packages
|
||||
frontend/node_modules
|
||||
frontend/.next/cache
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/*.csproj') }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
images: gitea.joaoloureiro.dev.br/joaonloureiro/portfolio-backend
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=ref,event=branch
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Install Dependencies and Build
|
||||
run: |
|
||||
echo "Restoring backend NuGet packages..."
|
||||
dotnet restore backend
|
||||
- name: Extract metadata (tags, labels) for Frontend
|
||||
id: meta-frontend
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: gitea.joaoloureiro.dev.br/joaonloureiro/portfolio-frontend
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=ref,event=branch
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
echo "Building and publishing backend..."
|
||||
# This compiles the app and places the output in the 'publish' folder
|
||||
dotnet publish backend --configuration Release --output ./publish
|
||||
- name: Build and push Backend
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend
|
||||
push: true
|
||||
tags: ${{ steps.meta-backend.outputs.tags }}
|
||||
labels: ${{ steps.meta-backend.outputs.labels }}
|
||||
|
||||
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
|
||||
- name: Build and push Frontend
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./frontend
|
||||
push: true
|
||||
tags: ${{ steps.meta-frontend.outputs.tags }}
|
||||
labels: ${{ steps.meta-frontend.outputs.labels }}
|
||||
@@ -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
47
backend/Dockerfile
Normal 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"]
|
||||
@@ -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();
|
||||
|
||||
@@ -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
47
docker-compose.yml
Normal 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
|
||||
635
frontend/package-lock.json
generated
635
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -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"
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user