Skip to content

Commit 8282b34

Browse files
authored
Merge pull request #128 from vineet081/add/dockerfile-and-ci
Add Dockerfile, docker-compose and CI workflow for easier local devel… Thanks @vineet081 !
2 parents 4cc04d5 + 1cd8482 commit 8282b34

4 files changed

Lines changed: 86 additions & 0 deletions

File tree

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
__pycache__/
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
.git
6+
.github
7+
*.egg-info
8+
dist/
9+
build/
10+
.env
11+
.venv
12+
venv/
13+
*.ipynb
14+
.tox/

.github/workflows/docker.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Docker Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- README.md
9+
pull_request:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- README.md
14+
workflow_dispatch:
15+
16+
jobs:
17+
docker:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Build Docker image
23+
run: docker build -t harmony-test .
24+
25+
- name: Run tests inside Docker container
26+
run: |
27+
docker run \
28+
-e HARMONY_LITE=no_transformers \
29+
-e PYTHONPATH=/app/src \
30+
harmony-test

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM python:3.10-slim
2+
3+
# Install Java (required by Tika for PDF parsing)
4+
RUN apt-get update && apt-get install -y \
5+
default-jdk \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
# Set Java environment
9+
ENV JAVA_HOME=/usr/lib/jvm/default-java
10+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
11+
12+
WORKDIR /app
13+
14+
# Copy and install dependencies
15+
COPY requirements.txt .
16+
RUN pip install --no-cache-dir -r requirements.txt
17+
18+
# Install dev dependencies
19+
RUN pip install --no-cache-dir pytest tox
20+
21+
# Copy source code
22+
COPY . .
23+
24+
# Set Python path so src/ is found
25+
ENV PYTHONPATH=/app/src
26+
27+
CMD ["python", "-m", "pytest", "tests/", "-v"]

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: '3.8'
2+
3+
services:
4+
harmony:
5+
build: .
6+
volumes:
7+
- .:/app
8+
- harmony_models:/root/harmony
9+
environment:
10+
- PYTHONPATH=/app/src
11+
- HARMONY_LITE=no_transformers
12+
command: python -m pytest tests/ -v
13+
14+
volumes:
15+
harmony_models:

0 commit comments

Comments
 (0)