Project-Stage-Academy / UA1198ForumSB

UA-1198 Project Stage Forum SandBox
0 stars 0 forks source link

Dockerize the Django application and add PostgreSQL support with secu… #32

Closed HurmakR closed 1 week ago

HurmakR commented 1 week ago

…re environment variables

Nazar-Humeniuk commented 1 week ago

Why we do not add couple more new things? Like

  1. Add ENV PYTHONUNBUFFERED 1 which is useful to ensure that Python output is sent directly to the terminal (important for logging in Docker).
  2. Create virtual environment that helps us isolates the dependencies, which is a good practice.
  3. Add non-root user and switches to this user, enhancing security by not running the application as root.
  4. Remove temporary files after installation, which helps keep the image size down by using rm -rf /tmp command
  5. Set up the environment variable ENV PATH="/py/bin:$PATH"

This suggestion maybe can help us in this project.

HurmakR commented 1 week ago
  1. Combined RUN commands have been applied.
  2. The container is running as a non-root user.
  3. Virtual environment activated.
  4. Removing unnecessary files after installation applied.
  5. Comments in English only