feat(dev): adiciona ambiente docker hot reload e corrige erros de compilacao
This commit is contained in:
parent
2bfe3b7173
commit
b3237187bc
3 changed files with 120 additions and 0 deletions
36
air.toml
Normal file
36
air.toml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
root = "."
|
||||
test_data_dir = "testdata"
|
||||
tmp_dir = "tmp"
|
||||
|
||||
[build]
|
||||
bin = "./tmp/main"
|
||||
cmd = "go build -o ./tmp/main ./cmd/api"
|
||||
delay = 1000
|
||||
exclude_dir = ["assets", "tmp", "vendor", "tests"]
|
||||
exclude_file = []
|
||||
exclude_regex = ["_test.go"]
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
full_bin = ""
|
||||
include_dir = []
|
||||
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||
kill_delay = "0s"
|
||||
log = "build-errors.log"
|
||||
send_interrupt = false
|
||||
stop_on_error = true
|
||||
|
||||
[color]
|
||||
app = ""
|
||||
build = "yellow"
|
||||
main = "magenta"
|
||||
runner = "green"
|
||||
watcher = "cyan"
|
||||
|
||||
[log]
|
||||
time = false
|
||||
|
||||
[misc]
|
||||
clean_on_exit = false
|
||||
|
||||
[screen]
|
||||
clear_on_rebuild = false
|
||||
57
docker-compose.dev.yml
Normal file
57
docker-compose.dev.yml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
container_name: ghj-db-dev
|
||||
environment:
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: gohorsejobs
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- ghj-db-dev-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U user -d gohorsejobs"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
backend:
|
||||
image: cosmtrek/air
|
||||
container_name: ghj-backend-dev
|
||||
working_dir: /app
|
||||
ports:
|
||||
- "8521:8521"
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://user:password@db:5432/gohorsejobs?sslmode=disable
|
||||
- JWT_SECRET=rede5-secret-key-at-least-32-chars-long
|
||||
- PASSWORD_PEPPER=rede5-pepper
|
||||
- COOKIE_SECRET=rede5-cookie-secret
|
||||
- ENV=development
|
||||
- BACKEND_PORT=8521
|
||||
- CORS_ORIGINS=https://ghj.rede5.com.br,http://localhost:3000
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
- ./air.toml:/app/.air.toml
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
command: -c .air.toml
|
||||
|
||||
frontend:
|
||||
image: node:22-alpine
|
||||
container_name: ghj-frontend-dev
|
||||
working_dir: /app
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NEXT_PUBLIC_API_URL=https://api-ghj.rede5.com.br/api/v1
|
||||
- NODE_ENV=development
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
depends_on:
|
||||
- backend
|
||||
command: sh -c "npm install && npm run dev"
|
||||
|
||||
volumes:
|
||||
ghj-db-dev-data:
|
||||
27
nginx.conf
Normal file
27
nginx.conf
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name ghj.rede5.com.br;
|
||||
|
||||
location / {
|
||||
proxy_pass http://172.18.0.4:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name api-ghj.rede5.com.br;
|
||||
|
||||
location / {
|
||||
proxy_pass http://172.18.0.3:8521;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue