Skip to content

Commit 0c144e4

Browse files
committed
Added DockerFile And Actions to Build the Docker Image
1 parent e4ed706 commit 0c144e4

4 files changed

Lines changed: 128 additions & 0 deletions

File tree

.dockerignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
*.so
5+
.Python
6+
build/
7+
develop-eggs/
8+
dist/
9+
downloads/
10+
eggs/
11+
.eggs/
12+
lib/
13+
lib64/
14+
parts/
15+
sdist/
16+
var/
17+
wheels/
18+
*.egg-info/
19+
.installed.cfg
20+
*.egg
21+
22+
.env
23+
.venv
24+
env/
25+
venv/
26+
ENV/
27+
env.bak/
28+
venv.bak/
29+
30+
logs/
31+
*.log
32+
33+
.DS_Store
34+
.vscode/
35+
.idea/
36+
37+
faiss_index/
38+
*.faiss
39+
40+
workflow.png
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Log in to GitHub Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: |
39+
type=ref,event=branch
40+
type=ref,event=pr
41+
type=semver,pattern={{version}}
42+
type=semver,pattern={{major}}.{{minor}}
43+
type=sha
44+
45+
- name: Build and push Docker image
46+
uses: docker/build-push-action@v5
47+
with:
48+
context: .
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
53+
- name: Image digest
54+
run: echo ${{ steps.docker_build.outputs.digest }}

Docker Guide.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Docker commands for RAG Project
2+
3+
## Build the Docker image
4+
docker build -t rag-project .
5+
6+
## Run the container
7+
docker run -d -p 8000:8000 --name rag-app \
8+
-e GROQ_API_KEY=your_groq_api_key \
9+
-e GOOGLE_API_KEY=your_google_api_key \
10+
-e LANGSMITH_API_KEY=your_langsmith_api_key \
11+
-e TAVILY_API_KEY=your_tavily_api_key \
12+
rag-project
13+
14+
## Run with .env file
15+
docker run -d -p 8000:8000 --name rag-app --env-file .env rag-project
16+
17+

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
COPY pyproject.toml ./
6+
COPY requirements.txt* ./
7+
8+
RUN pip install --no-cache-dir uv && \
9+
uv pip install --system --no-cache -r pyproject.toml
10+
11+
COPY . .
12+
13+
EXPOSE 8000
14+
15+
ENV PYTHONUNBUFFERED=1
16+
17+
CMD ["python", "app.py"]

0 commit comments

Comments
 (0)