quando dou o docker compose docker compose up --build acontece o localhost:8080 nao fica disponivel para mim e aparece as seguintes mensagens no meu terminal
postgres-1 |
postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres-1 |
postgres-1 | 2024-11-01 20:41:39.229 UTC [1] LOG: starting PostgreSQL 17.0 (Debian 17.0-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
postgres-1 | 2024-11-01 20:41:39.229 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres-1 | 2024-11-01 20:41:39.229 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres-1 | 2024-11-01 20:41:39.231 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1 | 2024-11-01 20:41:39.235 UTC [29] LOG: database system was shut down at 2024-11-01 20:28:35 UTC
postgres-1 | 2024-11-01 20:41:39.240 UTC [1] LOG: database system is ready to accept connections
app-1 | main.go is a directory, should be a Go file
app-1 exited with code 1
docker-compose.yml
services:
postgres:
image: "postgres"
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=root
ports:
- 5432:5432
volumes:
- ./postgres-data:/var/lib/postgresql/data
app:
build: .
ports:
- 8080:8080
depends_on:
- postgres
environment:
- DB_HOST=postgres
- DB_USER=root
- DB_PASSWORD=root
- DB_NAME=root
- DB_PORT=5432
Dockerfile
FROM golang:1.22
EXPOSE 8080
WORKDIR /app
COPY ./assets/ /app/assets/
COPY ./controllers/ /app/controllers/
COPY ./database/ /app/database/
COPY ./models/ /app/models/
COPY ./routes/ /app/routes/
COPY ./templates/ /app/templates/
COPY ./main.go /app/main.go/
COPY ./go.mod /app/go.mod/
COPY ./go.sum /app/go.sum/
CMD [ "go", "run", "main.go" ]