Compare commits

...

8 Commits
master ... ma

Author SHA1 Message Date
hsc de44063645 feat:构建和部署 Go 应用程序的 Docker镜像
continuous-integration/drone/push Build is passing Details
- 新增 build_img.sh 脚本,用于构建 Go 应用程序和 Docker镜像
- 创建 Dockerfile,定义 Alpine Linux 基础镜像和应用程序配置
- 更新 hello.go,实现一个简单的 HTTP服务器
- 删除 hello.sh,移除不再需要的示例脚本
2025-04-26 19:19:09 +08:00
hsc fe590df87b chore: 添加项目无关文件的 .gitignore 规则
continuous-integration/drone/push Build was killed Details
- 忽略 Maven 构建目录 /target
- 忽略 IntelliJ IDEA 项目配置文件 /.idea- 忽略未定义日志路径文件 /log.path_IS_UNDEFINED- 忽略临时文件目录 /tmp
2025-04-07 18:15:30 +08:00
hsc e34f7247ec chore: 添加项目无关文件的 .gitignore 规则
continuous-integration/drone/push Build is failing Details
- 忽略 Maven 构建目录 /target
- 忽略 IntelliJ IDEA 项目配置文件 /.idea- 忽略未定义日志路径文件 /log.path_IS_UNDEFINED- 忽略临时文件目录 /tmp
2025-04-07 17:58:46 +08:00
hsc 5790d1e1c2 chore: 添加项目无关文件的 .gitignore 规则
continuous-integration/drone/push Build is passing Details
- 忽略 Maven 构建目录 /target
- 忽略 IntelliJ IDEA 项目配置文件 /.idea- 忽略未定义日志路径文件 /log.path_IS_UNDEFINED- 忽略临时文件目录 /tmp
2025-04-07 17:49:30 +08:00
hsc be38fc6876 chore: 添加项目无关文件的 .gitignore 规则
continuous-integration/drone/push Build is passing Details
- 忽略 Maven 构建目录 /target
- 忽略 IntelliJ IDEA 项目配置文件 /.idea- 忽略未定义日志路径文件 /log.path_IS_UNDEFINED- 忽略临时文件目录 /tmp
2025-04-07 17:45:41 +08:00
hsc 86f8c309ad refactor: 更新 hello.sh脚本
- 移除了多余的空行
- 保留了 Dev-Go 版本信息
- 保留了 Hello World 输出
- 保留了作者信息
2025-04-07 17:43:33 +08:00
hsc 6dc6da9af3 refactor: 更新 hello.sh脚本
- 移除了多余的空行
- 保留了 Dev-Go 版本信息
- 保留了 Hello World 输出
- 保留了作者信息
2025-04-07 17:42:31 +08:00
hsc abe71e4e2d refactor: 更新 hello.sh脚本
- 移除了多余的空行
- 保留了 Dev-Go 版本信息
- 保留了 Hello World 输出
- 保留了作者信息
2025-04-07 17:42:24 +08:00
7 changed files with 96 additions and 8 deletions

View File

@ -4,7 +4,7 @@ name: default
steps:
- name: run-hello-script
image: docker.1ms.run/alpine:latest # 必须指定基础镜像如alpine/bash
image: docker.1ms.run/docker:latest # 必须指定基础镜像如alpine/bash
commands:
- chmod +x hello.sh
- chmod +x ./hello.sh
- ./hello.sh

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/target
/.idea
/log.path_IS_UNDEFINED
/tmp

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
# 使用Alpine Linux作为基础镜像
FROM alpine:latest
# 设置作者标签
LABEL authors="18257"
# 安装必要的运行时依赖(如果有的话)
# 例如如果你的应用程序需要CGO支持你可能需要安装一些库
# RUN apk add --no-cache libc6-compat
# 将Go应用程序二进制文件复制到镜像中
# 假设你的Go应用程序二进制文件名为hello
COPY hello /app/hello
# 设置工作目录
WORKDIR /app
# 设置容器启动时运行的命令
ENTRYPOINT ["/app/hello"]

13
build_img.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# 构建Go应用程序
CGO_ENABLED=0 GOOS=linux go build -o hello ./hello.go
# 构建Docker镜像
docker build -t hello-app .
# 清理生成的二进制文件
rm hello
# 运行Docker容器
docker run --rm -p 8080:8080 hello-app

View File

@ -1,3 +1,18 @@
package main
import (
"fmt"
"net/http"
)
func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}
func main() {
fmt.Println("Hello, World!")
}
http.HandleFunc("/", helloHandler)
fmt.Println("Starting server at port 8080")
if err := http.ListenAndServe(":8080", nil); err != nil {
fmt.Println(err)
}
}

View File

@ -1,4 +0,0 @@
NAME="芒星DevOps指挥脚本"
VERSION="alpine"
echo "Welcome To NAME :${NAME}"

41
readme.md Normal file
View File

@ -0,0 +1,41 @@
# 🚀 项目名称: 芒星DevOps指挥脚本
## 📝 简介
该项目主要用于测试Drone CI/CD的相关属性。通过这个项目您可以了解和测试Drone的各种功能和配置。
## 🛠️ 工具和依赖
- **Drone**: 一个开源的持续集成和持续交付平台。
- **Shell脚本**: 用于编写自动化任务。
- **Docker**: 用于构建和推送镜像。
## 📦 安装和配置
1. **安装Drone**: 按照[Drone官方文档](https://docs.drone.io/)进行安装。
2. **配置Drone**: 根据您的需求配置Drone的`.drone.yml`文件。
## 🧪 测试属性
- **Pipeline触发**: 测试不同的触发条件,如代码推送、定时任务等。
- **环境变量**: 测试环境变量的配置和使用。
- **插件**: 测试Drone的各种插件如通知插件、部署插件等。
- **缓存**: 测试构建缓存的配置和效果。
## 📜 文档和资源
- [Drone官方文档](https://docs.drone.io/)
- [Drone插件列表](https://plugins.drone.io/)
## 🤝 贡献
欢迎贡献代码和提出问题!请参考[贡献指南](CONTRIBUTING.md)。
## 📄 许可证
本项目采用[MIT许可证](LICENSE)。
### 说明文档内容:
1. **项目名称**:使用 🚀 表示项目启动和重要性。
2. **简介**:使用 📝 表示文档和说明。
3. **工具和依赖**:使用 🛠️ 表示工具和依赖项。
4. **安装和配置**:使用 📦 表示安装包和配置。
5. **使用方法**:使用 🚀 表示启动和运行。
6. **测试属性**:使用 🧪 表示测试和实验。
7. **文档和资源**:使用 📜 表示文档和资源。
8. **贡献**:使用 🤝 表示合作和贡献。
9. **许可证**:使用 📄 表示法律和许可证。