File tree Expand file tree Collapse file tree 4 files changed +80
-7
lines changed Expand file tree Collapse file tree 4 files changed +80
-7
lines changed Original file line number Diff line number Diff line change 1- name : Publish to PyPI
1+ name : Publish to PyPI and Docker Hub
22
33on :
44 push :
4242 run : |
4343 poetry build
4444 poetry publish
45+
46+ - name : Set up Docker Buildx
47+ uses : docker/setup-buildx-action@v2
48+
49+ - name : Login to Docker Hub
50+ uses : docker/login-action@v2
51+ with :
52+ username : ${{ secrets.DOCKERHUB_USERNAME }}
53+ password : ${{ secrets.DOCKERHUB_TOKEN }}
54+
55+ - name : Build and push Docker image
56+ uses : docker/build-push-action@v4
57+ with :
58+ context : .
59+ push : true
60+ tags : |
61+ ${{ secrets.DOCKERHUB_USERNAME }}/mysql-ch-replicator:latest
62+ ${{ secrets.DOCKERHUB_USERNAME }}/mysql-ch-replicator:${{ env.version }}
63+ cache-from : type=gha
64+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change 1717 run : >
1818 ls -la &&
1919 docker compose -f docker-compose-tests.yaml up --force-recreate --no-deps --wait -d &&
20- sudo docker exec -w /app/ -i `docker ps | grep python | awk '{print $1;}'` python3 -m pytest -x -v -s test_mysql_ch_replicator.py
20+ sudo docker exec -w /app/ -i `docker ps | grep mysql_ch_replicator-replicator | awk '{print $1;}'` python3 -m pytest -x -v -s test_mysql_ch_replicator.py
Original file line number Diff line number Diff line change 1+ FROM python:3.12.4-slim-bookworm
2+
3+ WORKDIR /app
4+
5+ # Copy requirements files
6+ COPY requirements.txt requirements-dev.txt ./
7+
8+ # Install dependencies
9+ RUN pip install --no-cache-dir -r requirements.txt \
10+ && pip install --no-cache-dir -r requirements-dev.txt
11+
12+ # Copy the application
13+ COPY . .
14+
15+ # Create directory for binlog data
16+ RUN mkdir -p /app/binlog
17+
18+ # Make the main script executable
19+ RUN chmod +x /app/main.py
20+
21+ # Set the entrypoint to the main script
22+ ENTRYPOINT ["/app/main.py" ]
23+
24+ # Default command (can be overridden in docker-compose)
25+ CMD ["--help" ]
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ services:
1717 - 9123:9123
1818 volumes :
1919 - ./tests_override.xml:/bitnami/clickhouse/etc/conf.d/override.xml:ro
20+ healthcheck :
21+ test : ["CMD", "true"]
22+ interval : 5s
23+ timeout : 1s
24+ retries : 1
25+ start_period : 15s
2026
2127 mysql_db :
2228 image : mysql:8.4.3
@@ -30,6 +36,12 @@ services:
3036 - ./test_mysql.cnf:/etc/mysql/my.cnf:ro
3137 networks :
3238 - default
39+ healthcheck :
40+ test : ["CMD", "true"]
41+ interval : 5s
42+ timeout : 1s
43+ retries : 1
44+ start_period : 15s
3345
3446 mariadb_db :
3547 image : mariadb:11.5.2
@@ -43,15 +55,31 @@ services:
4355 - 9307:3306
4456 volumes :
4557 - ./test_mariadb.cnf:/etc/mysql/my.cnf:ro # Adjust path to MariaDB config location if needed
58+ healthcheck :
59+ test : ["CMD", "true"]
60+ interval : 5s
61+ timeout : 1s
62+ retries : 1
63+ start_period : 15s
4664
4765 replicator :
48- image : python:3.12.4-slim-bookworm
49- command : bash -c "pip install -r /app/requirements.txt && pip install -r /app/requirements-dev.txt && touch /tmp/ready && tail -f /dev/null"
66+ build :
67+ context : .
68+ dockerfile : Dockerfile
69+ network_mode : host
70+ volumes :
71+ - ./:/app/
72+ entrypoint : ["/bin/bash"]
73+ command : ["-c", "touch /tmp/ready && tail -f /dev/null"]
5074 healthcheck :
5175 test : [ 'CMD-SHELL', 'test -f /tmp/ready' ]
5276 interval : 2s
5377 retries : 100
5478 start_period : 10s
55- network_mode : host
56- volumes :
57- - ./:/app/
79+ depends_on :
80+ clickhouse_db :
81+ condition : service_healthy
82+ mysql_db :
83+ condition : service_healthy
84+ mariadb_db :
85+ condition : service_healthy
You can’t perform that action at this time.
0 commit comments