Skip to content

Commit 54896ab

Browse files
committed
feature: 数据库镜像制作
1 parent 8a0228b commit 54896ab

File tree

22 files changed

+303
-78
lines changed

22 files changed

+303
-78
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Database Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'scripts/db/**'
8+
- 'scripts/images/database/**'
9+
- '.github/workflows/docker-image-database.yml'
10+
pull_request:
11+
branches: [ "main" ]
12+
paths:
13+
- 'scripts/db/**'
14+
- 'scripts/images/database/**'
15+
- '.github/workflows/docker-image-database.yml'
16+
workflow_dispatch:
17+
18+
jobs:
19+
call-docker-build:
20+
name: Build and Push Database Docker Image
21+
uses: ./.github/workflows/docker-images-reusable.yml
22+
permissions:
23+
contents: read
24+
packages: write
25+
with:
26+
service_name: database
27+
build_dir: .

.github/workflows/docker-image-runtime.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ on:
44
push:
55
branches: [ "main" ]
66
paths:
7-
- 'runtime/**'
7+
- 'runtime/ops/**'
8+
- 'runtime/python-executor/**'
89
- 'scripts/images/runtime/**'
910
- '.github/workflows/docker-image-runtime.yml'
1011
pull_request:
1112
branches: [ "main" ]
1213
paths:
13-
- 'runtime/**'
14+
- 'runtime/ops/**'
15+
- 'runtime/python-executor/**'
1416
- 'scripts/images/runtime/**'
1517
- '.github/workflows/docker-image-runtime.yml'
1618
workflow_dispatch:

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build-%:
1818
$(MAKE) $*-docker-build
1919

2020
.PHONY: build
21-
build: backend-docker-build frontend-docker-build runtime-docker-build
21+
build: database-docker-build backend-docker-build frontend-docker-build runtime-docker-build
2222

2323
.PHONY: create-namespace
2424
create-namespace:
@@ -105,6 +105,10 @@ endif
105105
backend-docker-build:
106106
docker build -t datamate-backend:$(VERSION) . -f scripts/images/backend/Dockerfile
107107

108+
.PHONY: database-docker-build
109+
database-docker-build:
110+
docker build -t datamate-database:$(VERSION) . -f scripts/images/database/Dockerfile
111+
108112
.PHONY: frontend-docker-build
109113
frontend-docker-build:
110114
docker build -t datamate-frontend:$(VERSION) . -f scripts/images/frontend/Dockerfile
@@ -206,20 +210,18 @@ milvus-docker-uninstall:
206210

207211
.PHONY: datamate-k8s-install
208212
datamate-k8s-install: create-namespace
209-
kubectl create configmap datamate-init-sql --from-file=scripts/db/ --dry-run=client -o yaml | kubectl apply -f - -n $(NAMESPACE)
210-
helm upgrade datamate deployment/helm/datamate/ -n $(NAMESPACE) --install --set global.image.repository=$(REPOSITORY)
213+
helm upgrade datamate deployment/helm/datamate/ -n $(NAMESPACE) --install --set global.image.repository=$(REGISTRY)
211214

212215
.PHONY: datamate-k8s-uninstall
213216
datamate-k8s-uninstall:
214217
helm uninstall datamate -n $(NAMESPACE) --ignore-not-found
215-
kubectl delete configmap datamate-init-sql -n $(NAMESPACE) --ignore-not-found
216218

217219
.PHONY: deer-flow-k8s-install
218220
deer-flow-k8s-install:
219-
helm upgrade datamate deployment/helm/datamate/ -n $(NAMESPACE) --install --set global.deerFlow.enable=true --set global.image.repository=$(REPOSITORY)
221+
helm upgrade datamate deployment/helm/datamate/ -n $(NAMESPACE) --install --set global.deerFlow.enable=true --set global.image.repository=$(REGISTRY)
220222
cp runtime/deer-flow/.env deployment/helm/deer-flow/charts/public/.env
221223
cp runtime/deer-flow/conf.yaml deployment/helm/deer-flow/charts/public/conf.yaml
222-
helm upgrade deer-flow deployment/helm/deer-flow -n $(NAMESPACE) --install --set global.image.repository=$(REPOSITORY)
224+
helm upgrade deer-flow deployment/helm/deer-flow -n $(NAMESPACE) --install --set global.image.repository=$(REGISTRY)
223225

224226
.PHONY: deer-flow-k8s-uninstall
225227
deer-flow-k8s-uninstall:

deployment/docker/datamate/docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ services:
4949
# 3) database
5050
datamate-database:
5151
container_name: datamate-database
52-
image: mysql:8
52+
image: ${REGISTRY:-}datamate-database
5353
restart: on-failure
5454
environment:
5555
MYSQL_ROOT_PASSWORD: password
@@ -61,8 +61,6 @@ services:
6161
"
6262
volumes:
6363
- mysql_volume:/var/lib/mysql
64-
- ../../../scripts/db:/docker-entrypoint-initdb.d
65-
- ./utf8.cnf:/etc/mysql/conf.d/utf8.cnf:ro
6664
- database_log_volume:/var/log/datamate/database
6765
ports:
6866
- "3306:3306"

deployment/helm/datamate/charts/database/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,9 @@ Name of image
6767
{{- define "database.image" -}}
6868
{{- $name := default .Values.image.repository .Values.global.image.database.name }}
6969
{{- $tag := default .Values.image.tag .Values.global.image.database.tag }}
70+
{{- if .Values.global.image.repository }}
71+
{{- .Values.global.image.repository | trimSuffix "/" }}/{{ $name }}:{{ $tag }}
72+
{{- else }}
7073
{{- $name }}:{{ $tag }}
7174
{{- end }}
75+
{{- end }}

deployment/helm/datamate/charts/database/templates/configmap.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

deployment/helm/datamate/charts/database/values.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,19 @@ replicaCount: 1
77

88
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
99
image:
10-
repository: "mysql"
10+
repository: "datamate-database"
1111
# This sets the pull policy for images.
1212
pullPolicy: "IfNotPresent"
1313
# Overrides the image tag whose default is the chart appVersion.
14-
tag: "8"
14+
tag: "latest"
1515

1616
# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
1717
imagePullSecrets: []
1818
# This is to override the chart name.
1919
nameOverride: "datamate-database"
2020
fullnameOverride: "datamate-database"
2121

22-
env:
23-
- name: MYSQL_ROOT_PASSWORD
24-
value: "password"
22+
env: []
2523

2624
initContainers:
2725
- name: init-log
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: public
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.0.1
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "0.0.1"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "public.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "public.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "public.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "public.labels" -}}
37+
helm.sh/chart: {{ include "public.chart" . }}
38+
{{ include "public.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "public.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "public.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}

0 commit comments

Comments
 (0)