Skip to content

Conversation

@PrajaktaNaik17
Copy link

Summary

This PR adds Docker and Docker Compose support to the fasthttp-postgres quickstart, allowing contributors to run the sample with a single command without manual setup.

Changes Made

  • Added Dockerfile with multi-stage build (final image: ~17MB)
  • Added docker-compose.yml with PostgreSQL service and health checks
  • Updated app.go to read database configuration from environment variables
  • Added .env.example for environment variable documentation
  • Updated .gitignore to exclude .env and build.log files
  • Updated go.mod and go.sum dependencies

Testing

  • Verified docker-compose up starts both services successfully
  • Confirmed environment variables are properly passed and used
  • Tested all API endpoints (GET/POST for books and authors)
  • Verified graceful shutdown works correctly
  • Confirmed no manual database setup is required

Usage

cd fasthttp-postgres
docker-compose up
curl http://localhost:8080/books

Closes #3405

- Add Dockerfile with multi-stage build for optimized image size (~17MB)
- Add docker-compose.yml for easy local development setup
- Configure PostgreSQL service with health checks and volume persistence
- Update app.go to support environment variables for database configuration
- Add .env.example for environment variable documentation
- Update .gitignore to exclude .env and build.log files
- Update go.mod and go.sum dependencies

The application can now be started with a single command: docker-compose up
No manual database or dependency setup is required.

Closes #3405

Signed-off-by: thund3rbird-17 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant