Skip to content

Commit 9ecfa0a

Browse files
authored
Add MySQL init container image for version (>= 8.0.21) (#5)
Signed-off-by: Tamal Saha <[email protected]> Signed-off-by: suaas21 <[email protected]>
1 parent a8f5a1d commit 9ecfa0a

File tree

7 files changed

+558
-2
lines changed

7 files changed

+558
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM tianon/toybox:0.8.4
2+
3+
COPY peer-finder /tmp/scripts/peer-finder
4+
5+
COPY scripts /tmp/scripts
6+
COPY init-script /init-script
7+
8+
ENTRYPOINT ["/init-script/run.sh"]

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@
178178
APPENDIX: How to apply the Apache License to your work.
179179

180180
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
181+
boilerplate notice, with the fields enclosed by brackets "{}"
182182
replaced with your own identifying information. (Don't include
183183
the brackets!) The text should be enclosed in the appropriate
184184
comment syntax for the file format. We also recommend that a
185185
file or class name and description of purpose be included on the
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright {yyyy} {name of copyright owner}
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
SHELL=/bin/bash -o pipefail
2+
3+
REGISTRY ?= kubedb
4+
BIN := mysql-init
5+
IMAGE := $(REGISTRY)/$(BIN)
6+
TAG := $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "")
7+
8+
9+
.PHONY: push
10+
push: container
11+
docker push $(IMAGE):$(TAG)
12+
13+
.PHONY: container
14+
container:
15+
curl -fsSL -O https://github.com/kmodules/peer-finder/releases/download/v1.1.0/peer-finder-linux-amd64.tar.gz
16+
tar -xzvf peer-finder-linux-amd64.tar.gz
17+
mv peer-finder-linux-amd64 peer-finder
18+
chmod +x peer-finder
19+
chmod +x init-script/run.sh
20+
find $$(pwd)/scripts -type f -exec chmod +x {} \;
21+
docker build --pull -t $(IMAGE):$(TAG) .
22+
rm peer-finder peer-finder-linux-amd64.tar.gz
23+
24+
.PHONY: version
25+
version:
26+
@echo ::set-output name=version::$(TAG)
27+
28+
.PHONY: fmt
29+
fmt:
30+
@find . -path ./vendor -prune -o -name '*.sh' -exec shfmt -l -w -ci -i 4 {} \;
31+
32+
.PHONY: verify
33+
verify: fmt
34+
@if !(git diff --exit-code HEAD); then \
35+
echo "files are out of date, run make fmt"; exit 1; \
36+
fi
37+
38+
.PHONY: ci
39+
ci: verify
40+
41+
# make and load docker image to kind cluster
42+
.PHONY: push-to-kind
43+
push-to-kind: container
44+
@echo "Loading docker image into kind cluster...."
45+
@kind load docker-image $(IMAGE):$(TAG)
46+
@echo "Image has been pushed successfully into kind cluster."

README.md

100644100755
File mode changed.

init-script/run.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
rm -rf /var/lib/mysql/lost+found
4+
5+
cp /tmp/scripts/* /scripts

0 commit comments

Comments
 (0)