-
Notifications
You must be signed in to change notification settings - Fork 27
Docker setup #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Docker setup #55
Conversation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Add admin router with user management endpoints - Create admin service for role-based access control - Add admin dashboard and user gallery templates - Implement admin authentication checks - Add unauthorized access template - Fix JWT configuration and improve token validation - Update gallery to show metadata JSON properly - Add admin navigation and styling - Update tests for new admin functionality
Summary of ChangesHello @safiya2610, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the project's operational capabilities by integrating Docker for containerization, ensuring a standardized and secure deployment environment. It streamlines the development workflow with Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces Docker support for the project, which is a great step towards consistent deployments. The implementation includes a Dockerfile, a docker-compose.yml, and a .dockerignore file. My review focuses on improving the Docker setup for better security, reproducibility, and efficiency. I've identified some critical issues, including a non-deterministic Docker build process and broken email/password login and signup forms. I have also suggested improvements for a bug in the admin panel's redirect logic and other code quality enhancements. Overall, the changes are good, but the identified issues should be addressed before merging.
| user_id = user_row[0] if user_row else 1 | ||
|
|
||
| return RedirectResponse(f"/admin/user/{user_id}", status_code=303) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback logic user_id = user_row[0] if user_row else 1 is risky. If the user is not found, it defaults to redirecting to the page for user with ID 1, which is incorrect and could cause confusion. It would be safer to redirect to the main admin dashboard (/admin) as a fallback.
| user_id = user_row[0] if user_row else 1 | |
| return RedirectResponse(f"/admin/user/{user_id}", status_code=303) | |
| user_id = user_row[0] if user_row else None | |
| if user_id: | |
| return RedirectResponse(f"/admin/user/{user_id}", status_code=303) | |
| return RedirectResponse("/admin", status_code=303) |
|
|
||
| <div class="card"> | ||
| <img src="/static/images/home3.jpg" alt="" class="img"> | ||
| </img> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| <div class="card"> | ||
| <img src="/static/images/home4.jpg" alt="" class="img"> | ||
| </img> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| from fastapi import FastAPI, HTTPException | ||
| from fastapi.exceptions import RequestValidationError | ||
| import os | ||
| import traceback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md
Outdated
| ### Security Features | ||
|
|
||
| - Non-root user in container | ||
| - Multi-stage build for minimal image size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation mentions that a multi-stage build is used for a minimal image size, but the current Dockerfile is a single-stage build. This discrepancy can be misleading. The documentation should be updated to match the implementation, or preferably, the Dockerfile should be converted to a multi-stage build to gain the described benefits.
Description
This PR adds Docker support to the project to enable consistent, secure, and reproducible deployments.
What’s included
Added a Dockerfile using python:3.11-slim for a lightweight image
Installed required system dependencies for image processing (OpenCV support)
Introduced a non-root user (app) for improved container security
Managed Python dependencies using pip-tools for reproducible builds
Copied application source code into the container with correct permissions
Exposed port 8000 and added a health check using curl
Configured application startup using Uvicorn
Docker Support
Prerequisites
Docker and Docker Compose installed
Quick Start
Copy .env.example to .env and fill in your secrets
Build and run with Docker Compose:
docker-compose up --build
Access the application at http://localhost:8000/
Docker Commands
Build the image: docker build -t bhv-app .
Run the container: docker run -p 8000:8000 --env-file .env bhv-app
Stop containers: docker-compose down
View logs: docker-compose logs