This commit is contained in:
Marcus 2026-01-31 11:12:41 -03:00
parent 7eaacae61e
commit d87f6e5604
2 changed files with 51 additions and 54 deletions

View file

@ -15,7 +15,7 @@ spec:
env: development
spec:
imagePullSecrets:
- name: registry-auth
- name: forgejo-registry
initContainers:
- name: set-mtu
image: busybox

View file

@ -1,53 +1,50 @@
build-and-push:
runs-on: docker-ready
apiVersion: apps/v1
kind: Deployment
metadata:
name: gohorse-backoffice-dev
namespace: gohorsejobsdev
spec:
replicas: 1
selector:
matchLabels:
app: gohorse-backoffice-dev
template:
metadata:
labels:
app: gohorse-backoffice-dev
env: development
spec:
imagePullSecrets:
- name: forgejo-registry
initContainers:
- name: set-mtu
image: busybox
# CORREÇÃO: Usando $(VAR) para o Kubernetes injetar o valor corretamente
command: ['sh', '-c', 'ifconfig eth0 mtu $(MTU_VALUE) || true']
env:
DOCKER_API_VERSION: "1.43"
REGISTRY: pipe.gohorsejobs.com
defaults:
run:
shell: sh
steps:
- name: Install Dependencies
run: |
sed -i 's/dl-cdn.alpinelinux.org/mirror.leaseweb.com/g' /etc/apk/repositories
apk add --no-cache git docker-cli docker-cli-buildx nodejs
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
# REMOVIDO: docker buildx create (Isso estava isolando o login e causando o 401)
- name: Login to Forgejo Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: bohessefm
password: ${{ secrets.FORGEJO_TOKEN }}
- name: Build and Push Backend
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile
push: true
# Força o uso do builder padrão do host que JÁ ESTÁ LOGADO
builder: default
provenance: false
tags: |
${{ env.REGISTRY }}/bohessefm/gohorsejobs:latest
${{ env.REGISTRY }}/bohessefm/gohorsejobs:${{ github.sha }}
- name: Build and Push Backoffice
uses: docker/build-push-action@v5
with:
context: ./backoffice
file: ./backoffice/Dockerfile
push: true
# Força o uso do builder padrão do host que JÁ ESTÁ LOGADO
builder: default
provenance: false
tags: |
${{ env.REGISTRY }}/bohessefm/backoffice:latest
${{ env.REGISTRY }}/bohessefm/backoffice:${{ github.sha }}
- name: MTU_VALUE
valueFrom:
secretKeyRef:
name: backend-secrets
key: MTU
securityContext:
privileged: true
containers:
- name: backoffice
image: pipe.gohorsejobs.com/bohessefm/backoffice:latest
imagePullPolicy: Always
ports:
- containerPort: 3001
envFrom:
- secretRef:
name: backend-secrets
env:
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: "0"
resources:
requests:
memory: "512Mi" # Reduzi um pouco o request para facilitar o agendamento no nó
cpu: "300m"
limits:
memory: "2Gi"
cpu: "800m"