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 # Git
**/.dockerignore .git
**/.env .gitignore
**/.git .gitattributes
**/.gitignore .gitmodules
**/.project
**/.settings # CI/CD
**/.toolstarget .gitea/
**/.vs .github/
**/.vscode *.yml
**/*.*proj.user *.yaml
**/*.dbmdl
**/*.jfm # Documentation
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md README.md
!**/.gitignore *.md
!.git/HEAD docs/
!.git/config
!.git/packed-refs # Build artifacts
!.git/refs/heads/** **/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 - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 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 - name: Build and push Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
file: ./Dockerfile
platforms: linux/arm64 platforms: linux/arm64
push: true push: true
tags: | tags: |
registry.redecarneir.us/onlyoneaccesstemplate:latest registry.redecarneir.us/onlyoneaccesstemplate:latest
registry.redecarneir.us/onlyoneaccesstemplate:${{ github.sha }} registry.redecarneir.us/onlyoneaccesstemplate:${{ github.sha }}
cache-from: type=gha cache-from: |
cache-to: type=gha,mode=max 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 - name: Deploy to OCI Server
uses: appleboy/ssh-action@v1.0.3 uses: appleboy/ssh-action@v1.0.3
with: with:
host: 129.146.116.218 host: 129.146.116.218
# username: ${{ secrets.SSH_USERNAME }} username: ${{ secrets.SSH_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }} key: ${{ secrets.SSH_PRIVATE_KEY }}
username: ubuntu
port: 22 port: 22
timeout: 60s
script: | script: |
# Para qualquer container que esteja usando a porta 80 # Para qualquer container que esteja usando a porta 80
echo "=== Verificando containers na 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 FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src
# Copiar apenas arquivos de projeto primeiro (melhor cache)
COPY ["OnlyOneAccessTemplate/OnlyOneAccessTemplate.csproj", "OnlyOneAccessTemplate/"] 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 . . COPY . .
WORKDIR "/src/OnlyOneAccessTemplate" 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 FROM build AS publish
ARG BUILD_CONFIGURATION=Release 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 FROM base AS final
WORKDIR /app WORKDIR /app

View File

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