This commit is contained in:
Eduardo Lopes 2026-02-10 15:00:56 -03:00 committed by GitHub
commit 3704c99a59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 50 additions and 7 deletions

View File

@ -28,13 +28,29 @@ ng generate --help
## Building
### Local (com Node instalado)
To build the project run:
```bash
ng build
npm run build
```
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
### VPS/Servidor sem Node no host (recomendado neste projeto)
Execute o build **dentro do container Docker do frontend**:
```bash
docker compose -f docker-compose.frontend.yml run --rm frontend-builder
```
Se quiser rodar exatamente o comando `npm run build` dentro do container:
```bash
docker compose -f docker-compose.frontend.yml run --rm frontend-builder sh -lc "npm run build"
```
Os artefatos serão gerados em `dist/line-gestao-frontend`.
## Running unit tests

View File

@ -3,9 +3,14 @@ server {
server_name _;
root /usr/share/nginx/html;
index index.html;
index index.csr.html;
# Angular SSR static browser build uses index.csr.html as the SPA entrypoint.
location = /index.html {
try_files /index.csr.html =404;
}
location / {
try_files $uri $uri/ /index.html;
try_files $uri $uri/ /index.csr.html;
}
}

View File

@ -43,13 +43,16 @@ cd ~/apps/line-gestao-frontend
cat > src/environments/environment.production.ts <<'EOT'
export const environment = {
production: true,
apiUrl: 'https://linegestao.inglinesystems.com.br'
apiUrl: ''
};
EOT
# 3) build de produção via container Node
# 3) build de produção via container Node (não rodar npm no host)
docker compose -f docker-compose.frontend.yml run --rm frontend-builder
# opcional: equivalente a executar `npm run build` dentro do container
# docker compose -f docker-compose.frontend.yml run --rm frontend-builder sh -lc "npm run build"
# 4) validar saída estática
ls -lah dist/line-gestao-frontend/browser
```
@ -85,6 +88,25 @@ cd ~/apps/line-gestao-api
docker compose -f docker-compose.domain.yml up -d caddy
```
## 404 no domínio após build (caso comum neste projeto)
Se o container `frontend-nginx` subir, mas `https://linegestao.inglinesystems.com.br` continuar em 404, valide:
```bash
# 1) arquivo de entrada do build Angular SSR
ls -lah ~/apps/line-gestao-frontend/dist/line-gestao-frontend/browser/index.csr.html
# 2) recarregar Nginx do front após atualizar config
cd ~/apps/line-gestao-frontend
docker compose -f docker-compose.frontend.yml up -d --force-recreate frontend-nginx
# 3) testar origem do Nginx localmente no VPS
curl -i http://127.0.0.1:8081/
```
Neste repositório, o Nginx do front deve apontar para `index.csr.html` (e não `index.html`).
---
## Bloco C — validação (curl + navegador)

View File

@ -1,4 +1,4 @@
export const environment = {
production: true,
apiUrl: 'https://linegestao.inglinesystems.com.br'
apiUrl: ''
};