File tree 4 files changed +80
-7
lines changed 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
2
2
3
3
on :
4
4
push :
42
42
run : |
43
43
poetry build
44
44
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 17
17
run : >
18
18
ls -la &&
19
19
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:
17
17
- 9123:9123
18
18
volumes :
19
19
- ./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
20
26
21
27
mysql_db :
22
28
image : mysql:8.4.3
@@ -30,6 +36,12 @@ services:
30
36
- ./test_mysql.cnf:/etc/mysql/my.cnf:ro
31
37
networks :
32
38
- default
39
+ healthcheck :
40
+ test : ["CMD", "true"]
41
+ interval : 5s
42
+ timeout : 1s
43
+ retries : 1
44
+ start_period : 15s
33
45
34
46
mariadb_db :
35
47
image : mariadb:11.5.2
@@ -43,15 +55,31 @@ services:
43
55
- 9307:3306
44
56
volumes :
45
57
- ./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
46
64
47
65
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"]
50
74
healthcheck :
51
75
test : [ 'CMD-SHELL', 'test -f /tmp/ready' ]
52
76
interval : 2s
53
77
retries : 100
54
78
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