Sign inSign up

rafaelrodriguess/taking-notes-api

By rafaelrodriguess

Updated about 2 months ago

API for taking notes and managing tasks

Image
Languages & frameworks
API management
Web servers
1

134

rafaelrodriguess/taking-notes-api repository overview

Taking Notes API - Rafael Rodrigues

Docker Image Size Python Version

This is the official image for the Taking Notes API, a secure and robust backend application for managing notes. The image is built using python:3.13-alpine, ensuring a lightweight, high-performance, and secure environment ideal for production workloads.

🚀 About this Image

This image packages the entire application and its dependencies, ready to be deployed. It follows Docker security and performance best practices:

  • Uses an entrypoint.sh script to handle environment initialization and start the application server.
  • Exposes port 8000.
  • Securely manages internal static and media directories (/data/web/static and /data/web/media).
  • Runs the application process with a non-root user (duser), ensuring an essential layer of security.
  • Avoids writing .pyc files and disables Python output buffering for optimal container logging.

🛠️ Usage (Docker Compose)

The application requires a PostgreSQL database to function correctly. The recommended way to orchestrate the services is by using Docker Compose.

Create a docker-compose.yml file with the following setup:

services:
  db:
    image: postgres:17
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    env_file:
      - .env
    networks:
      - note-taking-network

  web:
    image: rafaelrodriguess/taking-notes-api:latest
    ports:
      - "8000:8000"
    depends_on:
      - db
    env_file:
      - .env
    networks:
      - note-taking-network

volumes:
  postgres_data:

networks:
  note-taking-network:

⚙️ Environment Variables (.env)

You must provide a .env file to configure the application's behavior and the database connection. Place it in the same directory as your docker-compose.yml:

# Application Settings
SECRET_KEY="your-super-secure-secret-key"
DEBUG=0
ALLOWED_HOSTS=localhost,127.0.0.1,your-domain.com
CORS_ALLOWED_ORIGINS=http://localhost:3000,https://your-frontend-domain.com

# PostgreSQL Database Configuration
POSTGRES_DB="notes_db"
POSTGRES_USER="postgres_user"
POSTGRES_PASSWORD="your_secure_password"
POSTGRES_HOST="db" # Must match the service name in docker-compose
POSTGRES_PORT="5432"

📂 Internal Volumes

The image is configured to manage files in specific internal directories. It is highly recommended to map them to named volumes if you need data persistence for these assets:

  • /data/web/static: Collected static files (CSS, JS, fonts).
  • /data/web/media: Media files or attachments uploaded by users.

🔒 Security and Performance Focus

This image was designed with production in mind:

  • Alpine Linux Base: Drastically reduces the final image size and minimizes the attack surface.
  • Non-root user (duser): Prevents the application from running as root, restricting potential unauthorized access within the container.
  • Python Optimization: Default environment variables PYTHONDONTWRITEBYTECODE=1 and PYTHONUNBUFFERED=1 are active to prevent caching clutter and ensure immediate log output.

Developed by Rafael Rodrigues.

Tag summary

Content type

Image

Digest

sha256:d0e97309c

Size

53.2 MB

Last updated

about 2 months ago

docker pull rafaelrodriguess/taking-notes-api