feat: implement Docker-based deployment and update environment configuration
Some checks failed
/ build-push (push) Has been cancelled
Some checks failed
/ build-push (push) Has been cancelled
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
name: Deploy Angular via SSH
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node 16
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Install and Build
|
||||
run: |
|
||||
npm install --legacy-peer-deps
|
||||
npm run build -- --prod
|
||||
|
||||
- name: Transferir arquivos via SCP
|
||||
uses: https://github.com/appleboy/scp-action@master
|
||||
with:
|
||||
host: ${{ secrets.REMOTE_HOST }}
|
||||
username: ${{ secrets.REMOTE_USER }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
source: "dist/"
|
||||
target: "/var/www/html/vendaweb-frontend"
|
||||
strip_components: 1
|
||||
|
||||
- name: Reiniciar Nginx Remoto
|
||||
uses: https://github.com/appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.REMOTE_HOST }}
|
||||
username: ${{ secrets.REMOTE_USER }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
script: |
|
||||
sudo systemctl reload nginx
|
||||
14
.gitea/workflows/deploy.yaml
Normal file
14
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
on: [push]
|
||||
jobs:
|
||||
build-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Login Harbor
|
||||
run: echo "${{ secrets.HARBOR_PASSWORD }}" | docker login 172.35.0.216 -u ${{ secrets.HARBOR_USERNAME }} --password-stdin
|
||||
- name: Build/Push
|
||||
run: |
|
||||
docker build -t 172.35.0.216/library/vendaweb-portal:latest .
|
||||
docker push 172.35.0.216/library/vendaweb-portal:latest
|
||||
- name: Webhook Portainer
|
||||
run: curl -X POST "${{ secrets.PORTAINER_WEBHOOK_FRONT }}"
|
||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM node:16-bullseye-slim AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install --legacy-peer-deps
|
||||
COPY . .
|
||||
RUN npm run build -- --prod
|
||||
|
||||
FROM nginx:alpine
|
||||
RUN apk add --no-cache gettext # Para o envsubst funcionar
|
||||
COPY --from=builder /app/dist/seu-projeto /usr/share/nginx/html
|
||||
|
||||
CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/assets/env.template.js > /usr/share/nginx/html/assets/env.js && exec nginx -g 'daemon off;'"]
|
||||
23
docker-compose.yml
Normal file
23
docker-compose.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
frontend:
|
||||
image: 172.35.0.216/library/vendaweb-portal:latest
|
||||
networks:
|
||||
- simplifique-network
|
||||
environment:
|
||||
- API_URL=${API_URL}
|
||||
- URL_PIX=${URL_PIX}
|
||||
- FIREBASE_API_KEY=${FIREBASE_API_KEY}
|
||||
deploy:
|
||||
replicas: 4
|
||||
update_config:
|
||||
parallelism: 1
|
||||
order: start-first
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
|
||||
networks:
|
||||
|
||||
simplifique-network:
|
||||
external: true
|
||||
14
nginx.conf
Normal file
14
nginx.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
upstream web_servers {
|
||||
# Nome da Stack
|
||||
server angular:80;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
proxy_pass http://web_servers;
|
||||
}
|
||||
location /api/ {
|
||||
proxy_pass http://api_servers/;
|
||||
}
|
||||
}
|
||||
5
src/assets/env.template.js
Normal file
5
src/assets/env.template.js
Normal file
@@ -0,0 +1,5 @@
|
||||
(function(window) {
|
||||
window["env"] = window["env"] || {};
|
||||
window["env"]["apiUrl"] = "${API_URL}";
|
||||
window["env"]["urlPix"] = "${URL_PIX}";
|
||||
})(this);
|
||||
@@ -37,6 +37,7 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<script src="assets/env.js"></script>
|
||||
<title>Plataforma Smart</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user