From e7a3e4e892678898f3235a63cba2b86cedf1473a Mon Sep 17 00:00:00 2001 From: Aaron Chen Date: Wed, 23 Oct 2024 07:17:31 +0000 Subject: [PATCH] first commit --- .gitignore | 1 + composer/aliyun/Dockerfile | 3 + dockerporter.go | 151 ++++++ go.mod | 5 + go.sum | 3 + images.yaml | 958 +++++++++++++++++++++++++++++++++++++ workerman/8.1/Dockerfile | 72 +++ workerman/8.2/Dockerfile | 72 +++ 8 files changed, 1265 insertions(+) create mode 100644 .gitignore create mode 100644 composer/aliyun/Dockerfile create mode 100644 dockerporter.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 images.yaml create mode 100644 workerman/8.1/Dockerfile create mode 100644 workerman/8.2/Dockerfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf0824e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.log \ No newline at end of file diff --git a/composer/aliyun/Dockerfile b/composer/aliyun/Dockerfile new file mode 100644 index 0000000..e319c7f --- /dev/null +++ b/composer/aliyun/Dockerfile @@ -0,0 +1,3 @@ +FROM composer:2.8.1 + +RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ diff --git a/dockerporter.go b/dockerporter.go new file mode 100644 index 0000000..9dbe53b --- /dev/null +++ b/dockerporter.go @@ -0,0 +1,151 @@ +package main + +import ( + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" + "time" + + "gopkg.in/yaml.v2" +) + +type Tag struct { + Tag string `yaml:"tag"` + Platforms []string `yaml:"platforms"` +} + +type Image struct { + Name string `yaml:"name"` + From string `yaml:"from,omitempty"` // `from` 为可选字段 + Tags []Tag `yaml:"tags"` +} + +type Config struct { + Target string `yaml:"target"` + Images []Image `yaml:"images"` +} + +func main() { + // 记录开始时间 + startTime := time.Now() + + // 创建日志文件名 + logFileName := fmt.Sprintf("build_%s.log", startTime.Format("20060102")) + logFile, err := os.OpenFile(logFileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644) + if err != nil { + logErrorInfo(logFile, time.Now(), + fmt.Sprintf("Error opening log file: %v", err)) + return + } + defer logFile.Close() + + // 记录程序启动时间 + logStartTime(logFile, startTime) + + // 读取 YAML 文件 + data, err := ioutil.ReadFile("images.yaml") + if err != nil { + logErrorInfo(logFile, time.Now(), + fmt.Sprintf("Error reading YAML file: %v", err)) + return + } + + // 解析 YAML 文件 + var config Config + if err := yaml.Unmarshal(data, &config); err != nil { + logErrorInfo(logFile, time.Now(), + fmt.Sprintf("Error parsing YAML: %v", err)) + return + } + + totalImages := 0 + totalTags := 0 + + // 遍历每个镜像信息 + for _, image := range config.Images { + // 如果 `from` 字段为空,则将其设置为 `name`(Docker Hub 官方镜像) + if image.From == "" { + image.From = image.Name + } + + imageBuilt := false // 记录是否构建过该镜像 + for _, tag := range image.Tags { + totalTags++ + // 根据镜像生成 Dockerfile + dockerfilePath := filepath.Join(".", fmt.Sprintf("Dockerfile.%s:%s", image.Name, tag.Tag)) + if err := generateDockerfile(image.From, tag.Tag, dockerfilePath); err != nil { + logErrorInfo(logFile, time.Now(), + fmt.Sprintf("Error generating Dockerfile for %s:%s: %v", image.Name, tag.Tag, err)) + continue + } + + // 合并所有平台为一个字符串 + platforms := strings.Join(tag.Platforms, ",") + // 构建 Docker 镜像命令,添加 target + buildCmd := exec.Command("docker", "buildx", "build", "--push", "--platform", platforms, "-t", fmt.Sprintf("%s/%s:%s", config.Target, image.Name, tag.Tag), "-f", dockerfilePath, ".") + buildCmd.Stdout = os.Stdout + buildCmd.Stderr = os.Stderr + + // 记录开始构建时间 + buildStartTime := time.Now() + if err := buildCmd.Run(); err != nil { + logErrorInfo(logFile, time.Now(), + fmt.Sprintf("Error building image %s:%s for platforms %s: %v", image.Name, tag.Tag, platforms, err)) + continue + } + // 记录构建结束时间 + buildEndTime := time.Now() + + // 记录构建日志 + logBuildInfo(logFile, buildStartTime, image.Name, tag.Tag, platforms, config.Target, buildEndTime.Sub(buildStartTime)) + imageBuilt = true // 标记该镜像已成功构建 + + // 删除生成的 Dockerfile + if err := os.Remove(dockerfilePath); err != nil { + logErrorInfo(logFile, time.Now(), + fmt.Sprintf("Error deleting Dockerfile %s: %v", dockerfilePath, err)) + } + } + if imageBuilt { + totalImages++ // 仅在成功构建过一次时增加镜像计数 + } + } + + // 计算总时间 + elapsedTime := time.Since(startTime) + logCompletion(logFile, elapsedTime, totalImages, totalTags) +} + +// 记录程序启动时间 +func logStartTime(logFile *os.File, startTime time.Time) { + logFile.WriteString(fmt.Sprintf("Process started at: %s\n", startTime.Format(time.RFC3339))) +} + +// 记录构建信息 +func logBuildInfo(logFile *os.File, startTime time.Time, imageName, tag string, platforms string, target string, duration time.Duration) { + logFile.WriteString(fmt.Sprintf("%s | Image: %s | Tag: %s | Platforms: %s | Pushed to: %s/%s:%s | Duration: %v\n", + startTime.Format(time.RFC3339), imageName, tag, platforms, target, imageName, tag, duration)) +} + +// 记录报错 +func logErrorInfo(logFile *os.File, startTime time.Time, errorMessage string) { + logFile.WriteString(fmt.Sprintf("%s | %s\n", + startTime.Format(time.RFC3339), errorMessage)) +} + +// 记录完成时间和统计信息 +func logCompletion(logFile *os.File, elapsedTime time.Duration, totalImages, totalTags int) { + logFile.WriteString(fmt.Sprintf("Build completed at: %s\n", time.Now().Format(time.RFC3339))) + logFile.WriteString(fmt.Sprintf("Total images built: %d\n", totalImages)) + logFile.WriteString(fmt.Sprintf("Total tags processed: %d\n", totalTags)) + logFile.WriteString(fmt.Sprintf("Total execution time: %v\n", elapsedTime)) +} + +// 生成 Dockerfile +func generateDockerfile(fromImage, tag, filePath string) error { + dockerfileContent := fmt.Sprintf("FROM %s:%s\n", fromImage, tag) + return ioutil.WriteFile(filePath, []byte(dockerfileContent), 0644) +} \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..16d44b1 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module porter + +go 1.23.2 + +require gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..7534661 --- /dev/null +++ b/go.sum @@ -0,0 +1,3 @@ +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/images.yaml b/images.yaml new file mode 100644 index 0000000..af7e6d0 --- /dev/null +++ b/images.yaml @@ -0,0 +1,958 @@ +target: "quay.io/wandoubaba517" + +images: + - name: "openresty" + from: "openresty/openresty" + tags: + - tag: "1.25.3.2-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.25.3.2-bookworm" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "golang" + from: "golang" + tags: + - tag: "1.23.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.23" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.22.8" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.22" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "python" + from: "python" + tags: + - tag: "3.13.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12.7" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.11.10" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.11" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.10.15" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.10" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.9.20" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.9" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.7.18" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.7" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "nacos-server" + from: "nacos/nacos-server" + tags: + - tag: "v2.4.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "v2.3.2" + platforms: + - "linux/amd64" + - tag: "v1.4.7" + platforms: + - "linux/amd64" + + - name: "zookeeper" + from: "zookeeper" + tags: + - tag: "3.9.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.9" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.8.4" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.8" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.7.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.7" + platforms: + - "linux/amd64" + - "linux/arm64" + + + - name: "elasticsearch" + from: "docker.elastic.co/elasticsearch/elasticsearch" + tags: + - tag: "7.17.18" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.14.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - name: "kibana" + from: "docker.elastic.co/kibana/kibana" + tags: + - tag: "7.17.18" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.14.2" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "gitea" + from: "gitea/gitea" + tags: + - tag: "1.22.3" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.22" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "grafana" + from: "grafana/grafana" + tags: + - tag: "11.2.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "11.1.7" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "11.0.6" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "10.4.10" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "9.5.21" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "memcached" + tags: + - tag: "latest" + platforms: + - "linux/amd64" + - "linux/arm64" + - "linux/mips64le" + - tag: "1.6.31" + platforms: + - "linux/amd64" + - "linux/arm64" + - "linux/mips64le" + - tag: "1.6" + platforms: + - "linux/amd64" + - "linux/arm64" + - "linux/mips64le" + - tag: "1" + platforms: + - "linux/amd64" + - "linux/arm64" + - "linux/mips64le" + + + - name: "mongo" + tags: + - tag: "8.0.1" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.0.14" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6.0.18" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "mysql" + tags: + - tag: "9.0.1" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "9.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "9" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.4.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.4" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0.39" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "5.7.37" + platforms: + - "linux/amd64" + - tag: "5.7" + platforms: + - "linux/amd64" + - tag: "5.6.51" + platforms: + - "linux/amd64" + - tag: "5.6" + platforms: + - "linux/amd64" + + - name: "pgadmin4" + from: "dpage/pgadmin4" + tags: + - tag: "8.12" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.11" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.10" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.9" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "portainer-ce" + from: "portainer/portainer-ce" + tags: + - tag: "latest" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.21.3-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.21.3" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "rabbitmq" + tags: + - tag: "4.0.2-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4.0.2-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4.0-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4.0-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13.7-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13.7-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12.14-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12.14-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3-management-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3-management" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4.0.2-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4.0.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4.0-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "4" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13.7-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13.7" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.13" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12.14-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12.14" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3.12" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "3" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "redis" + tags: + - tag: "7.4.1-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.2.6-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.2-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6.2.16-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6.2-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "5.0.5-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "5.0-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "5-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4.1" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.2.6" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6.2.16" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "6" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "5.0.5" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "5.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "5" + platforms: + - "linux/amd64" + - "linux/arm64" + + + - name: "postgres" + tags: + - tag: "14.13" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "14" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "15.8" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "15" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16.4" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "17.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "17" + platforms: + - "linux/amd64" + - "linux/arm64" + + + - name: "php" + tags: + - tag: "8.3.12-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.3-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2.24-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1.30-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0.30-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4.33-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4-fpm-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.3.12-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.3-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2.24-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1.30-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0.30-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4.33-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4-cli-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.3.12-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.3-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2.24-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1.30-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0.30-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4.33-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4-fpm" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.3.12-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.3-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2.24-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.2-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1.30-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.1-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0.30-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "8.0-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4.33-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "7.4-cli" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "composer" + tags: + - tag: "latest" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.8.1" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.8" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.7.9" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.7" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.2.24" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "2.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.10.27" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.10" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1" + platforms: + - "linux/amd64" + - "linux/arm64" + + + - name: "nginx" + tags: + - tag: "latest" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.27.2-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.27-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.26.2-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.26-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.24.0-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.24-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.27.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.27" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.26.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.26" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.24.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "1.24" + platforms: + - "linux/amd64" + - "linux/arm64" + + - name: "node" + tags: + - tag: "22.9.0-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "22.9-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "22-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "22.9.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "22.9" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "22" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "20.18.0-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "20.18-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "20-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "20.18.0" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "20.18" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "20" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "18.20.4-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "18.20-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "18-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "18.20.4" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "18.20" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "18" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16.20.2-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16.20-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16-alpine" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16.20.2" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16.20" + platforms: + - "linux/amd64" + - "linux/arm64" + - tag: "16" + platforms: + - "linux/amd64" + - "linux/arm64" diff --git a/workerman/8.1/Dockerfile b/workerman/8.1/Dockerfile new file mode 100644 index 0000000..3046f51 --- /dev/null +++ b/workerman/8.1/Dockerfile @@ -0,0 +1,72 @@ +# 拉基础镜像 +FROM php:8.1.27-cli + +# 替换源 +RUN rm /etc/apt/sources.list.d/debian.sources && \ + echo 'deb http://mirror.us.oneandone.net/debian bookworm main' > /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian bookworm main' >> /etc/apt/sources.list && \ + echo 'deb http://mirror.us.oneandone.net/debian-security bookworm-security main' >> /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian-security bookworm-security main' >> /etc/apt/sources.list && \ + echo 'deb http://mirror.us.oneandone.net/debian bookworm-updates main' >> /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian bookworm-updates main' >> /etc/apt/sources.list && \ + echo 'deb http://mirror.us.oneandone.net/debian bookworm-backports main' >> /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian bookworm-backports main' >> /etc/apt/sources.list + +# 安装一些依赖 +RUN apt-get update && apt-get install -y \ + libfreetype6-dev libjpeg62-turbo-dev \ + libpng-dev libwebp-dev zlib1g-dev \ + libzip-dev zip \ + libevent-dev libssl-dev \ + lsb-release libpq-dev \ + libgmp-dev \ + libmagickwand-dev \ + libzookeeper-mt-dev \ + librdkafka-dev + +# 安装扩展 +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ + && docker-php-ext-install -j$(nproc) gd \ + && docker-php-ext-install exif \ + && docker-php-ext-install opcache \ + && docker-php-ext-install pdo_mysql \ + && docker-php-ext-install mysqli \ + && docker-php-ext-install zip \ + && docker-php-ext-install pcntl \ + && docker-php-ext-install fileinfo \ + && pecl install https://pecl.php.net/get/redis-6.0.2.tgz \ + && docker-php-ext-enable redis \ + && docker-php-ext-install sockets \ + && pecl install https://pecl.php.net/get/event-3.1.4.tgz \ + && docker-php-ext-enable event \ + && cat /usr/local/etc/php/conf.d/docker-php-ext-event.ini >> /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini \ + && mv /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini /usr/local/etc/php/conf.d/docker-php-ext-event.ini \ + && docker-php-ext-install -j$(nproc) pgsql pdo_pgsql \ + && pecl install https://pecl.php.net/get/mongodb-1.19.3.tgz \ + && docker-php-ext-enable mongodb \ + && docker-php-ext-install -j$(nproc) gmp \ + && pecl install https://pecl.php.net/get/imagick-3.7.0.tgz \ + && docker-php-ext-enable imagick \ + && docker-php-ext-install bcmath \ + && docker-php-ext-enable bcmath \ + && pecl install https://pecl.php.net/get/xlswriter-1.5.5.tgz \ + && docker-php-ext-enable xlswriter \ + && pecl install https://pecl.php.net/get/zookeeper-1.2.1.tgz \ + && docker-php-ext-enable zookeeper \ + && pecl install https://pecl.php.net/get/rdkafka-6.0.3.tgz \ + && docker-php-ext-enable rdkafka + +# 安装Composer +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ + && php composer-setup.php \ + && php -r "unlink('composer-setup.php');" \ + && mv composer.phar /usr/local/bin/composer + +# 安装swow扩展 +# RUN composer require swow/swow && ./vendor/bin/swow-builder --install + +# 创建应用目录 +RUN mkdir -p /app/service + +# 设置工作目录 +WORKDIR /app/service diff --git a/workerman/8.2/Dockerfile b/workerman/8.2/Dockerfile new file mode 100644 index 0000000..5453555 --- /dev/null +++ b/workerman/8.2/Dockerfile @@ -0,0 +1,72 @@ +# 拉基础镜像 +FROM php:8.2.23-cli + +# 替换源 +RUN rm /etc/apt/sources.list.d/debian.sources && \ + echo 'deb http://mirror.us.oneandone.net/debian bookworm main' > /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian bookworm main' >> /etc/apt/sources.list && \ + echo 'deb http://mirror.us.oneandone.net/debian-security bookworm-security main' >> /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian-security bookworm-security main' >> /etc/apt/sources.list && \ + echo 'deb http://mirror.us.oneandone.net/debian bookworm-updates main' >> /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian bookworm-updates main' >> /etc/apt/sources.list && \ + echo 'deb http://mirror.us.oneandone.net/debian bookworm-backports main' >> /etc/apt/sources.list && \ + echo 'deb-src http://mirror.us.oneandone.net/debian bookworm-backports main' >> /etc/apt/sources.list + +# 安装一些依赖 +RUN apt-get update && apt-get install -y \ + libfreetype6-dev libjpeg62-turbo-dev \ + libpng-dev libwebp-dev zlib1g-dev \ + libzip-dev zip \ + libevent-dev libssl-dev \ + lsb-release libpq-dev \ + libgmp-dev \ + libmagickwand-dev \ + libzookeeper-mt-dev \ + librdkafka-dev + +# 安装扩展 +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \ + && docker-php-ext-install -j$(nproc) gd \ + && docker-php-ext-install exif \ + && docker-php-ext-install opcache \ + && docker-php-ext-install pdo_mysql \ + && docker-php-ext-install mysqli \ + && docker-php-ext-install zip \ + && docker-php-ext-install pcntl \ + && docker-php-ext-install fileinfo \ + && pecl install https://pecl.php.net/get/redis-6.1.0.tgz \ + && docker-php-ext-enable redis \ + && docker-php-ext-install sockets \ + && pecl install https://pecl.php.net/get/event-3.1.4.tgz \ + && docker-php-ext-enable event \ + && cat /usr/local/etc/php/conf.d/docker-php-ext-event.ini >> /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini \ + && mv /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini /usr/local/etc/php/conf.d/docker-php-ext-event.ini \ + && docker-php-ext-install -j$(nproc) pgsql pdo_pgsql \ + && pecl install https://pecl.php.net/get/mongodb-1.19.3.tgz \ + && docker-php-ext-enable mongodb \ + && docker-php-ext-install -j$(nproc) gmp \ + && pecl install https://pecl.php.net/get/imagick-3.7.0.tgz \ + && docker-php-ext-enable imagick \ + && docker-php-ext-install bcmath \ + && docker-php-ext-enable bcmath \ + && pecl install https://pecl.php.net/get/xlswriter-1.5.5.tgz \ + && docker-php-ext-enable xlswriter \ + && pecl install https://pecl.php.net/get/zookeeper-1.2.1.tgz \ + && docker-php-ext-enable zookeeper \ + && pecl install https://pecl.php.net/get/rdkafka-6.0.3.tgz \ + && docker-php-ext-enable rdkafka + +# 安装Composer +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ + && php composer-setup.php \ + && php -r "unlink('composer-setup.php');" \ + && mv composer.phar /usr/local/bin/composer + +# 安装swow扩展 +# RUN composer require swow/swow && ./vendor/bin/swow-builder --install + +# 创建应用目录 +RUN mkdir -p /app/service + +# 设置工作目录 +WORKDIR /app/service