ARTICLE AD BOX
I just start learning Golang and I'm currently using Echo.
I have an endpoint :
- base/api/wallet/cardnumber -> get card details
and I execute "go run .\main.go" and the API provide correct result.
And I'm trying to dockerized it and when I hit the same API, I always got
{"message":"Internal Server Error"}
I don't know what went wrong. I've tried following recomposing docker-compose and Dockerfile according to the official docker site but still no result. Might be I missed something. Thank you in advance.
Here's the Dockerfile :
FROM golang:1.25 WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN go get RUN go build -o bin . EXPOSE 8080 ENTRYPOINT ["/app/bin"]Here's the docker-compose.yml
services: db: image: postgres:16 restart: always container_name: postgres environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-root} POSTGRES_DB: ${POSTGRES_DB:-dev} PG_DATA: /var/lib/postgresql/data/pgdata ports: - "5435:5432" volumes: - postgres-data:/var/lib/postgresql/data - ./init-scripts:/docker-entrypoint-initdb.d healthcheck: test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB:-dev} -U ${POSTGRES_USER:-postgres}"] interval: 1s retries: 100 start_period: 10s networks: - app-network app: container_name: test-app image: test-app build: . depends_on: db: condition: service_healthy ports: - "8080:8080" environment: DATABASE_URL: postgres://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-root}@postgres:5432/${POSTGRES_DB:-dev}?sslmode=disable networks: - app-network volumes: postgres-data: driver: local networks: app-network: driver: bridgeedit : errors :
ERROR: relation "wallets" does not exist at character 50 SELECT w.wallets, balance, user_id FROM wallets w left join trx_history th ON w.card_id = th.card_id WHERE w.card_id = $1I've checked my table name , they are :
wallets trx_historyall lowercase
