Skip to content

Commit b041826

Browse files
committed
Fix Docker build context and image tag issues
- Create .dockerignore to exclude unnecessary files (.travis.yml, .git, etc.) - Remove Tag field from FromDockerfile - testcontainers generates its own tag format - Fixes 'invalid reference format' error (UUID:TAG:latest) and tar pipe errors
1 parent e272776 commit b041826

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Exclude unnecessary files from Docker build context
2+
.git
3+
.gitignore
4+
.travis.yml
5+
.github
6+
*.md
7+
*.sh
8+
*.go
9+
go.mod
10+
go.sum
11+
bin/
12+
dist/
13+
examples/
14+
scripts/
15+
docs/
16+
*.tf
17+
terraform.tfstate*
18+
.terraform/
19+
.DS_Store
20+
*.log
21+
*.backup
22+
Makefile
23+
GNUmakefile
24+
GORELEASER_GPGSIGNING_PLAN.md
25+
TERRAFORM_BINARY_OPTIMIZATION_PLAN.md
26+
TESTCONTAINERS_*.md
27+
TIDB_*.md
28+
WORKFLOW_OPTIMIZATION_ANALYSIS.md
29+
terraform-registry-manifest.json
30+
VERSION

mysql/testcontainers_helper.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,15 +600,13 @@ func startSharedTiDBClusterWithTiUP(version string) (*TiDBTestCluster, error) {
600600
return nil, fmt.Errorf("Dockerfile.tiup-playground not found at %s (moduleRoot=%s): %v", dockerfilePath, moduleRoot, err)
601601
}
602602

603-
// Use a consistent image tag for caching
604-
imageTag := fmt.Sprintf("terraform-provider-mysql-tiup-playground:latest")
605-
606603
req := testcontainers.ContainerRequest{
607604
FromDockerfile: testcontainers.FromDockerfile{
608605
Context: moduleRoot,
609606
Dockerfile: "Dockerfile.tiup-playground",
610-
PrintBuildLog: true, // Helpful for debugging
611-
Tag: imageTag, // Use consistent tag for caching
607+
PrintBuildLog: true, // Helpful for debugging
608+
// Don't set Tag - let testcontainers generate its own tag format
609+
// Setting Tag causes invalid format like UUID:TAG:latest
612610
},
613611
ExposedPorts: []string{"4000/tcp"},
614612
// TiUP Playground needs to run processes and requires elevated capabilities

0 commit comments

Comments
 (0)