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
Some checks failed
Build and Push Docker Images / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -1,124 +1,56 @@
|
|||||||
name: Build and Deploy to Production
|
name: Build and Push Docker Images
|
||||||
run-name: Deploying commit ${{ gitea.sha_short }} by @${{ gitea.actor }}
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ "main" ]
|
||||||
- main
|
tags: [ "v*" ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
build-and-push:
|
||||||
runs-on: website-deploy-runner
|
runs-on: website-deploy-runner
|
||||||
env:
|
|
||||||
DOTNET_INSTALL_DIR: "$HOME/.dotnet"
|
|
||||||
NEXT_TELEMETRY_DISABLED: '1'
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup .NET 8 SDK
|
- name: Log in to Gitea Registry
|
||||||
uses: actions/setup-dotnet@v4
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: '8.0.x'
|
registry: gitea.joaoloureiro.dev.br
|
||||||
|
username: ${{ secrets.GITEA_USER }}
|
||||||
|
password: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
- name: Cache NuGet packages
|
- name: Extract metadata (tags, labels) for Backend
|
||||||
uses: actions/cache@v4
|
id: meta-backend
|
||||||
with:
|
uses: docker/metadata-action@v5
|
||||||
path: ~/.nuget/packages
|
with:
|
||||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
images: gitea.joaoloureiro.dev.br/joaonloureiro/portfolio-backend
|
||||||
restore-keys: |
|
tags: |
|
||||||
${{ runner.os }}-nuget-
|
type=semver,pattern={{version}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
- name: Cache Node.js modules
|
- name: Extract metadata (tags, labels) for Frontend
|
||||||
uses: actions/cache@v4
|
id: meta-frontend
|
||||||
with:
|
uses: docker/metadata-action@v5
|
||||||
path: frontend/node_modules
|
with:
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
images: gitea.joaoloureiro.dev.br/joaonloureiro/portfolio-frontend
|
||||||
restore-keys: |
|
tags: |
|
||||||
${{ runner.os }}-node-
|
type=semver,pattern={{version}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
- name: Cache Next.js build cache
|
- name: Build and push Backend
|
||||||
uses: actions/cache@v4
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
path: frontend/.next/cache
|
context: ./backend
|
||||||
key: ${{ runner.os }}-next-cache-${{ hashFiles('frontend/package-lock.json') }}-${{ env.NODE_VERSION || 'node' }}
|
push: true
|
||||||
restore-keys: |
|
tags: ${{ steps.meta-backend.outputs.tags }}
|
||||||
${{ runner.os }}-next-cache-
|
labels: ${{ steps.meta-backend.outputs.labels }}
|
||||||
|
|
||||||
- name: Create Backend appsettings.Production.json
|
- name: Build and push Frontend
|
||||||
run: |
|
uses: docker/build-push-action@v5
|
||||||
echo "Creating backend appsettings.Production.json file..."
|
with:
|
||||||
mkdir -p backend
|
context: ./frontend
|
||||||
cat <<EOF > backend/appsettings.Production.json
|
push: true
|
||||||
{
|
tags: ${{ steps.meta-frontend.outputs.tags }}
|
||||||
"SmtpSettings": {
|
labels: ${{ steps.meta-frontend.outputs.labels }}
|
||||||
"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 }}",
|
|
||||||
"BackendPort": "${{ vars.BACKEND_PORT }}"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Create Frontend .env.local file
|
|
||||||
run: |
|
|
||||||
echo "Creating frontend .env.local file..."
|
|
||||||
mkdir -p frontend
|
|
||||||
cat <<EOF > frontend/.env.local
|
|
||||||
NEXT_PUBLIC_GITHUB_URL=${{ vars.NEXT_PUBLIC_GITHUB_URL }}
|
|
||||||
NEXT_PUBLIC_LINKEDIN_URL=${{ vars.NEXT_PUBLIC_LINKEDIN_URL }}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Install Dependencies and Build
|
|
||||||
run: |
|
|
||||||
echo "Restoring backend NuGet packages..."
|
|
||||||
dotnet restore backend/JoaoLoureiro.Portfolio.Api/JoaoLoureiro.Portfolio.Api.csproj
|
|
||||||
|
|
||||||
echo "Building and publishing backend..."
|
|
||||||
dotnet publish backend/JoaoLoureiro.Portfolio.Api/JoaoLoureiro.Portfolio.Api.csproj --configuration Release --output ./publish
|
|
||||||
|
|
||||||
echo "Copying backend appsettings to published output..."
|
|
||||||
# ensure the production appsettings travels with the published output so the deployed app reads it
|
|
||||||
if [ -f backend/appsettings.Production.json ]; then
|
|
||||||
mkdir -p ./publish
|
|
||||||
cp backend/appsettings.Production.json ./publish/
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing frontend dependencies..."
|
|
||||||
cd frontend && npm install
|
|
||||||
|
|
||||||
echo "Building frontend application..."
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
- name: Sync Files to Production Directory
|
|
||||||
run: |
|
|
||||||
echo "Syncing files to production directory..."
|
|
||||||
rsync -auv --itemize-changes --progress ./publish/ /var/www/website.joaoloureiro.dev.br/backend/
|
|
||||||
echo "rsync publish exit: $?"
|
|
||||||
|
|
||||||
rsync -auv --itemize-changes --progress ./frontend/.next/ /var/www/website.joaoloureiro.dev.br/frontend/.next/
|
|
||||||
echo "rsync .next exit: $?"
|
|
||||||
|
|
||||||
rsync -auv --itemize-changes --progress ./frontend/public/ /var/www/website.joaoloureiro.dev.br/frontend/public/
|
|
||||||
echo "rsync public exit: $?"
|
|
||||||
|
|
||||||
rsync -av --itemize-changes --progress ./frontend/package.json /var/www/website.joaoloureiro.dev.br/frontend/
|
|
||||||
echo "rsync package.json exit: $?"
|
|
||||||
|
|
||||||
# copy both frontend and backend ecosystem files into the deployment root so PM2 can find them
|
|
||||||
rsync -av --itemize-changes --progress ./frontend/ecosystem.config.json /var/www/website.joaoloureiro.dev.br/frontend/
|
|
||||||
echo "rsync frontend ecosystem exit: $?"
|
|
||||||
|
|
||||||
rsync -av --itemize-changes --progress ./backend/ecosystem.config.json /var/www/website.joaoloureiro.dev.br/backend/
|
|
||||||
echo "rsync backend ecosystem exit: $?"
|
|
||||||
|
|
||||||
- name: Restart Applications with PM2
|
|
||||||
env:
|
|
||||||
DEPLOY_PATH: ${{ vars.DEPLOY_PATH }}
|
|
||||||
run: |
|
|
||||||
echo "Restarting applications with PM2..."
|
|
||||||
restart-portfolio
|
|
||||||
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": {
|
"dependencies": {
|
||||||
"@heroicons/react": "^2.2.0",
|
"@heroicons/react": "^2.2.0",
|
||||||
"framer-motion": "^12.16.0",
|
"framer-motion": "^12.16.0",
|
||||||
"next": "15.3.3",
|
"next": "^15.5.6",
|
||||||
|
"next-auth": "^4.24.13",
|
||||||
"next-intl": "^4.1.0",
|
"next-intl": "^4.1.0",
|
||||||
"react": "^19.0.0",
|
"react": "^19.2.4",
|
||||||
"react-country-flag": "^3.1.0",
|
"react-country-flag": "^3.1.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.2.4",
|
||||||
"react-hot-toast": "^2.5.2",
|
"react-hot-toast": "^2.5.2",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-type-animation": "^3.2.0"
|
"react-type-animation": "^3.2.0"
|
||||||
@@ -31,4 +32,4 @@
|
|||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user