Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BACKEND_DIR := backend
BUILD_DIR := bin
MAIN_PATH := ./cmd/api

.PHONY: all build run test test-race fmt vet clean help db db-stop db-logs db-psql db-reset migrate migrate-down migrate-status
.PHONY: all build run dev test test-race fmt vet clean help db db-stop db-logs db-psql db-reset migrate migrate-down migrate-status

# Default target when running only 'make'
all: help
Expand All @@ -28,6 +28,10 @@ run: ## Run the API (go run, no binary left behind)
@echo "==> Running the API..."
cd $(BACKEND_DIR) && go run $(MAIN_PATH)

dev: ## Start everything in Docker (PostgreSQL + API)
@echo "==> Starting the full stack in Docker..."
docker compose up --build

test: ## Run all backend tests
@echo "==> Running tests..."
cd $(BACKEND_DIR) && go test ./...
Expand Down
17 changes: 17 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,22 @@ services:
timeout: 5s
retries: 5

api:
# Built from backend/Dockerfile (the build context is the backend/ folder).
build: ./backend
container_name: aktenlens-api
restart: unless-stopped
environment:
# Inside the Compose network the database host is the service name
# "postgres" and the port is the container port (5432), not the
# 127.0.0.1:5433 used from your own machine.
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable
ports:
# Bound to 127.0.0.1 so only this machine can reach the API.
- "127.0.0.1:8080:8080"
depends_on:
postgres:
condition: service_healthy

volumes:
aktenlens-postgres-data:
Loading