-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker compose files in example-mysql (#99)
* Add docker compose files in example-mysql * Update the example-mysql Docker image to `alpine` * Initialize database schema with `multiStatements=true` * Add `CGO_ENABLED=0` when building example-mysql * Add logs to `initDatabaseSchema`
- Loading branch information
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:1.22.5-bookworm@sha256:af9b40f2b1851be993763b85288f8434af87b5678af04355b1e33ff530b5765f as build | ||
|
||
WORKDIR /build | ||
|
||
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change | ||
COPY go.mod go.sum ./ | ||
RUN go mod download && go mod verify | ||
|
||
COPY . . | ||
RUN CGO_ENABLED=0 go build -v ./cmd/example-mysql | ||
|
||
FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5 | ||
|
||
COPY --from=build /build/example-mysql /build/cmd/example-mysql/docker/testdata/key /build/cmd/example-mysql/docker/testdata/key.pub /build/storage/mysql/schema.sql / | ||
|
||
ENTRYPOINT ["/example-mysql"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
services: | ||
|
||
tessera-example-mysql-db: | ||
container_name: tessera-mysql-db | ||
image: "mysql:8.4" | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=tessera | ||
- MYSQL_DATABASE=tessera | ||
- MYSQL_USER=tessera | ||
- MYSQL_PASSWORD=tessera | ||
restart: always | ||
healthcheck: | ||
test: mysql --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD --silent --execute "SHOW DATABASES;" | ||
interval: 5s | ||
timeout: 5s | ||
retries: 10 | ||
|
||
tessera-example-mysql: | ||
container_name: tessera-example-mysql | ||
build: | ||
context: ../../../ | ||
dockerfile: ./cmd/example-mysql/docker/Dockerfile | ||
ports: | ||
- "2024:2024" | ||
command: [ | ||
"--mysql_uri=tessera:tessera@tcp(tessera-example-mysql-db:3306)/tessera", | ||
"--init_schema_path=/schema.sql", | ||
"--private_key_path=/key", | ||
"--public_key_path=/key.pub", | ||
"--alsologtostderr", | ||
] | ||
restart: always | ||
depends_on: | ||
tessera-example-mysql-db: | ||
condition: service_healthy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PRIVATE+KEY+Test-Betty+df84580a+Afge8kCzBXU7jb3cV2Q363oNXCufJ6u9mjOY1BGRY9E2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Test-Betty+df84580a+AQQASqPUZoIHcJAF5mBOryctwFdTV1E0GRY4kEAtTzwB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters