fix:deploy
All checks were successful
Deploy ASP.NET MVC to OCI / build-and-deploy (push) Successful in 15m36s

This commit is contained in:
Ricardo Carneiro 2025-06-02 23:29:11 -03:00
parent 3e764dd685
commit 8697a90fd9
4 changed files with 111 additions and 37 deletions

View File

@ -1,30 +1,58 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
# Git
.git
.gitignore
.gitattributes
.gitmodules
# CI/CD
.gitea/
.github/
*.yml
*.yaml
# Documentation
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
*.md
docs/
# Build artifacts
**/bin/
**/obj/
**/out/
**/publish/
# VS Code
.vscode/
*.code-workspace
# Visual Studio
.vs/
*.user
*.suo
*.userosscache
*.sln.docstates
# Testing
**/TestResults/
**/*.trx
**/*.coverage
# Node modules (se houver)
node_modules/
npm-debug.log*
# Logs
*.log
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Temporary files
*.tmp
*.temp

View File

@ -17,26 +17,55 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Debug - List files
run: |
echo "=== Arquivos na raiz ==="
ls -la
echo "=== Procurando Dockerfile ==="
find . -name "Dockerfile" -o -name "dockerfile" -type f
echo "=== Estrutura do projeto ==="
tree -L 3 || find . -type d -name "OnlyOneAccessTemplate"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/arm64
push: true
tags: |
registry.redecarneir.us/onlyoneaccesstemplate:latest
registry.redecarneir.us/onlyoneaccesstemplate:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: |
type=local,src=/tmp/.buildx-cache
type=registry,ref=registry.redecarneir.us/onlyoneaccesstemplate:cache
cache-to: |
type=local,dest=/tmp/.buildx-cache-new,mode=max
type=registry,ref=registry.redecarneir.us/onlyoneaccesstemplate:cache,mode=max
build-args: |
BUILDKIT_INLINE_CACHE=1
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Deploy to OCI Server
uses: appleboy/ssh-action@v1.0.3
with:
host: 129.146.116.218
# username: ${{ secrets.SSH_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
username: ubuntu
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
timeout: 60s
script: |
# Para qualquer container que esteja usando a porta 80
echo "=== Verificando containers na porta 80 ==="

View File

@ -9,15 +9,31 @@ EXPOSE 8081
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
# Copiar apenas arquivos de projeto primeiro (melhor cache)
COPY ["OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj", "OnlyOneAccessTemplate/"]
RUN dotnet restore "./OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj"
RUN dotnet restore "./OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj" \
--runtime linux-arm64 \
--no-cache
# Copiar código fonte depois do restore
COPY . .
WORKDIR "/src/OnlyOneAccessTemplate"
RUN dotnet build "./OnlyOneAccessTemplate.csproj" -c $BUILD_CONFIGURATION -o /app/build
RUN dotnet build "./OnlyOneAccessTemplate.csproj" \
-c $BUILD_CONFIGURATION \
-o /app/build \
--runtime linux-arm64 \
--no-restore
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./OnlyOneAccessTemplate.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
RUN dotnet publish "./OnlyOneAccessTemplate.csproj" \
-c $BUILD_CONFIGURATION \
-o /app/publish \
--runtime linux-arm64 \
--no-restore \
--self-contained false \
/p:UseAppHost=false
FROM base AS final
WORKDIR /app

View File

@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "pipeline", "pipeline", "{21
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{2D004DDC-10EA-47D2-911A-216449BE686C}"
ProjectSection(SolutionItems) = preProject
.dockerignore = .dockerignore
Dockerfile = Dockerfile
EndProjectSection
EndProject