diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..00f9937 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.13 +WORKDIR /ETL + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +CMD ["python3", "./src/load.py"] \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..6725723 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,46 @@ +name: etl-and-db + +services: + db: + container_name: postgres_db + image: postgres:18.0-trixie + networks: + - backend + expose: + - "5432" + ports: + - "8081:5432" + shm_size: 128mb + environment: + - POSTGRES_PASSWORD=${DB_PASSWORD} + - POSTGRES_USER=${DB_USER} + - POSTGRES_DB=${DB_NAME} + volumes: + - postgres_data:/var/lib/postgresql + healthcheck: + test: ["CMD", "pg_isready", "-U", "etl_agent", "-d", "LMS-Test"] + interval: 30s + retries: 3 + start_period: 30s + timeout: 10s + restart: always + + etl: + image: etl-pipeline:0.3 + depends_on: + - db + networks: + - backend + command: "python3 ./src/orchestrator.py" + restart: no + volumes: + - postgres_data:/var/lib/etl + pre_stop: + - command: docker cp CONTAINER:/var/lib/etl/lms-etl.log /tmp/app_logs + +networks: + backend: + name: pg_network + +volumes: + postgres_data: \ No newline at end of file