Utilizing Docker for portability
This commit is contained in:
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@@ -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"]
|
||||||
46
compose.yaml
Normal file
46
compose.yaml
Normal file
@@ -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:
|
||||||
Reference in New Issue
Block a user