Compare commits
8 Commits
109229c0aa
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa3b5dc9d2 | ||
| bbc5ca8856 | |||
|
|
d64a53774d | ||
| 76095c15d0 | |||
| 750645fdb0 | |||
|
|
cc1ab1b6a6 | ||
| 510bf7a530 | |||
| 0fd088a222 |
14
.dockerignore
Normal file
14
.dockerignore
Normal file
@@ -0,0 +1,14 @@
|
||||
.git
|
||||
.gitea
|
||||
node_modules
|
||||
dist
|
||||
coverage
|
||||
.angular
|
||||
.cache
|
||||
npm-debug.log
|
||||
yarn-debug.log
|
||||
yarn-error.log
|
||||
Dockerfile*
|
||||
docker-compose*.yml
|
||||
README*
|
||||
*.md
|
||||
@@ -1,25 +1,66 @@
|
||||
on: [push]
|
||||
name: Build (develop) / Promote (main)
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build-push:
|
||||
build-and-push-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Login Harbor
|
||||
run: echo "${{ secrets.HARBOR_PASSWORD }}" | docker login 172.35.0.216 -u ${{ secrets.HARBOR_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build/Push with Tagging
|
||||
- name: Build and Push
|
||||
run: |
|
||||
REPO="172.35.0.216/library/vendaweb-portal"
|
||||
VERSION="v${{ gitea.run_number }}"
|
||||
|
||||
echo "Iniciando build da versão: $VERSION"
|
||||
|
||||
docker build -t $REPO:$VERSION -t $REPO:latest .
|
||||
|
||||
docker push $REPO:$VERSION
|
||||
docker push $REPO:latest
|
||||
set -euo pipefail
|
||||
REGISTRY="git.simplifiquehc.com.br"
|
||||
IMAGE_NAME="$REGISTRY/simplifique/vendaweb-portal"
|
||||
SHA_TAG=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
|
||||
- name: Webhook Portainer
|
||||
run: curl -X POST "${{ secrets.PORTAINER_WEBHOOK_FRONT }}"
|
||||
REGISTRY_USERNAME="${{ secrets.REGISTRY_USERNAME }}"
|
||||
if [ -z "$REGISTRY_USERNAME" ]; then
|
||||
REGISTRY_USERNAME="${{ github.actor }}"
|
||||
fi
|
||||
|
||||
REGISTRY_PASSWORD="${{ secrets.REGISTRY_PASSWORD }}"
|
||||
if [ -z "$REGISTRY_PASSWORD" ]; then
|
||||
REGISTRY_PASSWORD="${{ secrets.K8S }}"
|
||||
fi
|
||||
|
||||
if [ -z "$REGISTRY_USERNAME" ] || [ -z "$REGISTRY_PASSWORD" ]; then
|
||||
echo "Missing registry credentials. Set secrets.REGISTRY_USERNAME + secrets.REGISTRY_PASSWORD (recommended)"
|
||||
echo "(fallback supported: secrets.K8S as password)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s' "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USERNAME" --password-stdin
|
||||
|
||||
docker build -t "$IMAGE_NAME:$SHA_TAG" -t "$IMAGE_NAME:latest" .
|
||||
docker push "$IMAGE_NAME:$SHA_TAG"
|
||||
docker push "$IMAGE_NAME:latest"
|
||||
|
||||
- name: Update Manifest and Push to Git
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SHA_TAG=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
IMAGE_NAME="git.simplifiquehc.com.br/simplifique/vendaweb-portal"
|
||||
|
||||
MANIFEST_FILE="k8s/overlays/prod/deployment-image-digest-patch.yaml"
|
||||
|
||||
sed -i -E "s|^([[:space:]]*image: ${IMAGE_NAME}:).*|\\1${SHA_TAG}|g" "$MANIFEST_FILE"
|
||||
|
||||
if [ -z "${{ secrets.GITEA_TOKEN }}" ]; then
|
||||
echo "Missing secrets.GITEA_TOKEN (needed to push back to repo)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git remote set-url origin "https://${{ github.actor }}:${{ secrets.GITEA_TOKEN }}@git.simplifiquehc.com.br/simplifique/Vendaweb-portal.git"
|
||||
|
||||
git config user.name "Gitea Action"
|
||||
git config user.email "actions@simplifiquehc.com.br"
|
||||
|
||||
git add "$MANIFEST_FILE"
|
||||
git commit -m "chore: update image tag to $SHA_TAG [skip ci]"
|
||||
git push origin main
|
||||
|
||||
10
browserslist
10
browserslist
@@ -5,8 +5,10 @@
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
last 2 Chrome versions
|
||||
last 2 Edge versions
|
||||
last 2 Firefox versions
|
||||
last 2 Safari versions
|
||||
not dead
|
||||
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||
not op_mini all
|
||||
not IE 9-11
|
||||
|
||||
27
k8s/argocd/application-prod.yaml
Normal file
27
k8s/argocd/application-prod.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: vendaweb-portal-prod
|
||||
namespace: argocd
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://git.simplifiquehc.com.br/simplifique/Vendaweb-portal.git
|
||||
targetRevision: main
|
||||
path: k8s/overlays/prod
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: vendawebfront-prod
|
||||
syncPolicy:
|
||||
automated:
|
||||
selfHeal: true
|
||||
prune: true
|
||||
retry:
|
||||
limit: 2
|
||||
backoff:
|
||||
duration: 5s
|
||||
factor: 2
|
||||
maxDuration: 3m
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
- PruneLast=true
|
||||
7
k8s/base/configmap.yaml
Normal file
7
k8s/base/configmap.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: vendaweb-portal-config
|
||||
data:
|
||||
API_URL: "https://vendaweb-api.example.com"
|
||||
URL_PIX: "https://pix.example.com"
|
||||
69
k8s/base/deployment.yaml
Normal file
69
k8s/base/deployment.yaml
Normal file
@@ -0,0 +1,69 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vendaweb-portal
|
||||
labels:
|
||||
app: vendaweb-portal
|
||||
spec:
|
||||
replicas: 3
|
||||
revisionHistoryLimit: 5
|
||||
minReadySeconds: 10
|
||||
progressDeadlineSeconds: 600
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 0
|
||||
selector:
|
||||
matchLabels:
|
||||
app: vendaweb-portal
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: vendaweb-portal
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: gitea-auth
|
||||
terminationGracePeriodSeconds: 30
|
||||
containers:
|
||||
- name: portal
|
||||
image: git.simplifiquehc.com.br/simplifique/vendaweb-portal:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: vendaweb-portal-config
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 6
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 24
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
7
k8s/base/kustomization.yaml
Normal file
7
k8s/base/kustomization.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- configmap.yaml
|
||||
15
k8s/base/service.yaml
Normal file
15
k8s/base/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: vendaweb-portal
|
||||
labels:
|
||||
app: vendaweb-portal
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: vendaweb-portal
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
10
k8s/overlays/prod/deployment-image-digest-patch.yaml
Normal file
10
k8s/overlays/prod/deployment-image-digest-patch.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vendaweb-portal
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: portal
|
||||
image: git.simplifiquehc.com.br/simplifique/vendaweb-portal:bbc5ca8
|
||||
6
k8s/overlays/prod/deployment-prod-patch.yaml
Normal file
6
k8s/overlays/prod/deployment-prod-patch.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vendaweb-portal
|
||||
spec:
|
||||
replicas: 2
|
||||
12
k8s/overlays/prod/kustomization.yaml
Normal file
12
k8s/overlays/prod/kustomization.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: vendawebfront-prod
|
||||
|
||||
resources:
|
||||
- ../../base
|
||||
|
||||
patches:
|
||||
- path: service-patch.yaml
|
||||
- path: deployment-prod-patch.yaml
|
||||
- path: deployment-image-digest-patch.yaml
|
||||
11
k8s/overlays/prod/service-patch.yaml
Normal file
11
k8s/overlays/prod/service-patch.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: vendaweb-portal
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30002
|
||||
@@ -1,7 +1,7 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
// url: 'http://10.1.1.124:8065/api/v1/',
|
||||
url: 'http://172.35.0.216:8065/api/v1/',
|
||||
url: 'https://api.vendaweb.simplifiquehc.com.br/api/v1/',
|
||||
// url: 'http://vendaweb.jurunense.com.br/api/v1/',
|
||||
URL_PIX: 'http://10.1.1.205:8078/api/v1/',
|
||||
firebase: {
|
||||
|
||||
@@ -11,7 +11,7 @@ export const environment = {
|
||||
// url: 'http://10.1.1.210:8065/api/v1/',
|
||||
// url: 'http://172.35.0.216:8065/api/v1/',
|
||||
//url: 'http://10.1.1.23:8065/api/v1/',
|
||||
url: 'http://localhost:8065/api/v1/',
|
||||
url: 'https://api.vendaweb.simplifiquehc.com.br/api/v1/',
|
||||
// url: 'http://10.1.1.124:8065/api/v1/',
|
||||
|
||||
// URL_PIX: 'http://10.1.1.205:8078/api/v1/',
|
||||
|
||||
Reference in New Issue
Block a user