-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add Docker configuration for containerized deployment #436
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: main
Are you sure you want to change the base?
Conversation
- Added Docker setup instructions to README.md and DOCKER.md. - Updated Dockerfiles for backend and frontend services. - Improved docker-compose configurations for development and production environments. - Introduced .dockerignore file to optimize Docker builds. - Added health checks for backend and frontend services in docker-compose files.
WalkthroughA comprehensive Docker setup was introduced for the Resume Matcher project. This includes new Dockerfiles for backend and frontend, production and development Docker Compose files, a detailed Docker setup guide, and an extensive Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Docker as Docker Engine
participant Compose as Docker Compose
participant Ollama as Ollama AI Service
participant Backend as Backend Service
participant Frontend as Frontend Service
Dev->>Docker: Build images (backend, frontend)
Dev->>Compose: Start services (docker-compose up)
Compose->>Ollama: Start Ollama container
Compose->>Ollama: Health check /api/tags
Compose->>Ollama-init: Wait for Ollama healthy, pull model
Compose->>Backend: Start after Ollama & Ollama-init ready
Compose->>Backend: Health check /health
Compose->>Frontend: Start after Backend healthy
Compose->>Frontend: Health check /
Dev->>Frontend: Access web app (port 3000)
Frontend->>Backend: API requests (rewritten via API_URL)
Backend->>Ollama: AI model requests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 5
🔭 Outside diff range comments (1)
Dockerfile.backend (1)
2-39
: Add non-root user for better security.The container runs as root, which poses security risks. Consider adding a non-root user.
FROM python:3.12-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV UV_CACHE_DIR=/tmp/uv-cache +# Create non-root user +RUN groupadd -r appuser && useradd -r -g appuser appuser + # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install uv RUN pip install uv # Set working directory WORKDIR /app +# Change ownership to appuser +RUN chown -R appuser:appuser /app + +# Switch to non-root user +USER appuser + # Copy backend files COPY apps/backend/ .
♻️ Duplicate comments (1)
docker-compose.yml (1)
80-92
:NEXT_PUBLIC_API_URL
build arg is passed, but Dockerfile doesn’t consume itWithout an
ARG
inDockerfile.frontend
, this value is lost (see Dockerfile comment). After fixing the Dockerfile, leave this block as-is.
🧹 Nitpick comments (6)
.dockerignore (1)
96-99
: Consider being more selective with documentation exclusions.Excluding all
.md
files might be too broad as some documentation might be needed at runtime (e.g., embedded help text, API documentation). Consider being more specific about which documentation files to exclude.# Documentation -README.md -*.md -docs/ +README.md +DOCKER.md +SETUP.md +docs/Dockerfile.backend (1)
16-16
: Consider installing uv using the official installer.Installing uv via pip might not provide the latest version. Consider using the official installer for better performance and latest features.
-# Install uv -RUN pip install uv +# Install uv using official installer +RUN curl -LsSf https://astral.sh/uv/install.sh | sh +ENV PATH="/root/.local/bin:$PATH"package.json (1)
26-26
: Consider less aggressive Docker cleanup.The
docker system prune -f
command removes all unused Docker resources system-wide, which might affect other projects. Consider a more targeted cleanup.-"docker:clean": "docker compose down -v --remove-orphans && docker system prune -f" +"docker:clean": "docker compose down -v --remove-orphans && docker image prune -f --filter label=project=resume-matcher"Or provide separate commands:
-"docker:clean": "docker compose down -v --remove-orphans && docker system prune -f" +"docker:clean": "docker compose down -v --remove-orphans", +"docker:clean:system": "docker system prune -f"DOCKER.md (3)
16-20
: Typo:docker-compo se.yml
Extra spaces split the filename, which will confuse copy-pasting.
-`docker-compo se.yml` +`docker-compose.yml`
40-45
: Command sample containsdocdocker
– looks like a paste artefact-docdocker compose ps +docker compose ps
227-235
: Reset section commands are mangledTwo typos will make the destructive commands fail:
-docdocker compose n -v --remove-orphans +# Stop & remove everything +docker compose down -v --remove-orphans -docdocker compose down --rmi all +docker compose down --rmi all
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
.dockerignore
(1 hunks)DOCKER.md
(1 hunks)Dockerfile.backend
(1 hunks)Dockerfile.frontend
(1 hunks)README.md
(2 hunks)apps/frontend/next.config.ts
(1 hunks)docker-compose.dev.yml
(1 hunks)docker-compose.yml
(1 hunks)package.json
(1 hunks)
🔇 Additional comments (9)
.dockerignore (2)
92-94
: Good practice: Selective lock file handling.Correctly keeping
package-lock.json
while excluding other lock files ensures npm dependencies are properly locked for consistent builds across environments.
69-71
: .dockerignore exclusions safe for multi-stage builds
- Grep search found no
COPY
/ADD
instructions pulling in other Dockerfiles ordocker-compose*.yml
.- Remember that
.dockerignore
only filters the build context sent bydocker build
—it does not preventdocker-compose
from reading its YAML files.- The Dockerfile itself is always loaded by the Docker CLI, so multi-stage builds remain unaffected.
No further changes required.
apps/frontend/next.config.ts (2)
5-5
: Excellent: Enabling standalone output for Docker.The
standalone
output mode is perfect for Docker containerization as it creates a self-contained application with all dependencies bundled, reducing image size and improving startup performance.
10-10
: Good practice: Dynamic API URL configuration.Using
NEXT_PUBLIC_API_URL
environment variable with a localhost fallback provides flexibility for different deployment environments while maintaining backward compatibility for local development.README.md (1)
74-95
: Excellent Docker documentation structure.The Docker installation section is well-organized with clear commands, environment options, and helpful quick reference commands. Good practice to make Docker the recommended approach while preserving local setup options.
Dockerfile.backend (1)
34-35
: Good practice: Health check implementation.The health check configuration is well-implemented with appropriate intervals and timeout values, enabling proper container orchestration and monitoring.
package.json (1)
21-25
: Excellent Docker script coverage.The Docker scripts provide comprehensive container lifecycle management with appropriate flags and configurations. Good separation of production and development environments.
Dockerfile.frontend (1)
56-58
: Health-check useswget
; ensure it exists
node:18-alpine
includes BusyBox’s minimalwget
, but if the base image changes this will break silently. Consider switching tocurl
(already installed in most images) or explicitlyapk add --no-cache wget
during thedeps
stage.docker-compose.dev.yml (1)
50-54
:target: base
assumes a stage that may not existEnsure
Dockerfile.backend
defines aFROM … AS base
stage. If not, the build will fail in dev mode.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Adding a relevant issue here |
Thanks |
Users may use their existing Ollama instance. It may be better to just add a env variable specifying the ollama endpoint. |
➕1 on this |
Good point thanks. I will fix it
… *vaddisrinivas* left a comment (srbhr/Resume-Matcher#436)
<#436 (comment)>
Users may use their existing Ollama instance. It may be better to just add
a env variable specifying the ollama endpoint.
➕1 on this
—
Reply to this email directly, view it on GitHub
<#436 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT7P7SNFXSQNJ4M2KWFUJPT3KGNV7AVCNFSM6AAAAACCIKJDVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMJWGIZTKNZUGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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.
I suggest to update the ollama and backend containers to include curl
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 5 | ||
start_period: 30s |
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.
Had a similar problem here with curl
. Here's the docker inspect output:
"Health": {
"Status": "unhealthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2025-07-25T13:33:35.929450468Z",
"End": "2025-07-25T13:33:36.011462273Z",
"ExitCode": -1,
"Output": "OCI runtime exec failed: exec failed: unable to start container process: exec: \"curl\": executable file not found in $PATH: unknown"
}
]
}
},
But now, it is impossible to manually install curl since the container is continuously restarting.
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.
Okay let me check
Having to provide your own ollama instance rather than having to spin up another ollama container would be nice. |
Sure i am working on that |
…improve health checks
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
DOCKER.md (1)
57-60
: Wrap bare URLs to satisfy markdownlint MD034Lines 57-59 trigger MD034 (bare URLs).
Wrapping them keeps the doc linter quiet and renders consistently across markdown viewers.- - Frontend: http://localhost:3000 - - Backend API: http://localhost:8000 - - Ollama API: http://localhost:11434 (if using containerized Ollama) + - Frontend: <http://localhost:3000> + - Backend API: <http://localhost:8000> + - Ollama API: <http://localhost:11434> (if using containerized Ollama)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
DOCKER.md
(1 hunks)Dockerfile.backend
(1 hunks)Dockerfile.frontend
(1 hunks)README.md
(2 hunks)docker-compose.dev.yml
(1 hunks)docker-compose.yml
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- Dockerfile.frontend
🚧 Files skipped from review as they are similar to previous changes (4)
- README.md
- Dockerfile.backend
- docker-compose.yml
- docker-compose.dev.yml
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
DOCKER.md
57-57: Bare URL used
(MD034, no-bare-urls)
58-58: Bare URL used
(MD034, no-bare-urls)
59-59: Bare URL used
(MD034, no-bare-urls)
|
||
- `Dockerfile.backend` - Backend FastAPI application container | ||
- `Dockerfile.frontend` - Frontend Next.js application container | ||
- `docker-compo se.yml` - Production deployment configuration |
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.
Fix misspelled compose filename
The list of Docker-related files shows "docker-compo se.yml
", which contains an internal space and drops the “s”.
Anyone copy-pasting will end up with a non-existent file name.
Proposed fix:
- - `docker-compo se.yml` - Production deployment configuration
+ - `docker-compose.yml` - Production deployment configuration
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- `docker-compo se.yml` - Production deployment configuration | |
- `docker-compose.yml` - Production deployment configuration |
🤖 Prompt for AI Agents
In DOCKER.md at line 18, fix the misspelled Docker compose filename by removing
the internal space and adding the missing "s" so it reads "docker-compose.yml"
instead of "docker-compo se.yml". This correction ensures the filename is
accurate and can be used correctly when copy-pasting.
### Reset Everything | ||
|
||
```bash | ||
# Stop and remove all containers, networks, and volumes | ||
docdocker compose n -v --remove-orphans | ||
|
||
# Remove all images | ||
docdocker compose down --rmi all | ||
|
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.
Correct the “Reset Everything” cleanup commands
The header has extra spaces and the commands contain the typo docdocker
, plus a malformed n
option. These will fail when executed.
-### Reset Everything
+### Reset Everything
@@
-docdocker compose n -v --remove-orphans
+docker compose down -v --remove-orphans
@@
-docdocker compose down --rmi all
+docker compose down --rmi all
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
### Reset Everything | |
```bash | |
# Stop and remove all containers, networks, and volumes | |
docdocker compose n -v --remove-orphans | |
# Remove all images | |
docdocker compose down --rmi all | |
### Reset Everything | |
🤖 Prompt for AI Agents
In DOCKER.md around lines 275 to 283, the "Reset Everything" section has extra
spaces in the header and incorrect commands with the typo "docdocker" and a
malformed "n" option. Remove the extra spaces in the header to make it "###
Reset Everything" and fix the commands by replacing "docdocker" with "docker"
and correcting the options to valid docker compose commands for stopping and
removing containers, networks, volumes, and images.
LGTM |
Followed blindly your instruction, I have an error with the backend not connecting to database. Here the logs |
Thanks for the report. I will fix it soon. I guess the problem is SQLite file is not created. |
@umidjon-2231 are you still working on the issue? can I give my hands |
Hi @mahimairaja , |
Description
This PR introduces a complete Docker-based deployment solution for Resume-Matcher, providing containerized environments for both development and production. The configuration eliminates the need for complex local environment setup by containerizing all services including the FastAPI backend, Next.js frontend, and Ollama AI service.
Relevant issue
#415
Type
Proposed Changes
Screenshots / Code Snippets (if applicable)
How to Test
git clone <repo> && cd Resume-Matcher
docker-compose build
docker-compose up -d
docker-compose down -v
to remove containers and volumesChecklist
Additional Information
Key Benefits:
docker-compose up -d
commandTechnical Implementation:
File Structure:
Breaking Changes:
Resource Requirements:
Summary by CodeRabbit
New Features
Documentation
Configuration