Compare commits
8 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
de44063645 | |
|
|
fe590df87b | |
|
|
e34f7247ec | |
|
|
5790d1e1c2 | |
|
|
be38fc6876 | |
|
|
86f8c309ad | |
|
|
6dc6da9af3 | |
|
|
abe71e4e2d |
|
|
@ -4,7 +4,7 @@ name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: run-hello-script
|
- name: run-hello-script
|
||||||
image: docker.1ms.run/alpine:latest # 必须指定基础镜像(如alpine/bash)
|
image: docker.1ms.run/docker:latest # 必须指定基础镜像(如alpine/bash)
|
||||||
commands:
|
commands:
|
||||||
- chmod +x hello.sh
|
- chmod +x ./hello.sh
|
||||||
- ./hello.sh
|
- ./hello.sh
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
/target
|
||||||
|
/.idea
|
||||||
|
/log.path_IS_UNDEFINED
|
||||||
|
/tmp
|
||||||
|
|
@ -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"]
|
||||||
|
|
@ -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
|
||||||
19
hello.go
19
hello.go
|
|
@ -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() {
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
4
hello.sh
4
hello.sh
|
|
@ -1,4 +0,0 @@
|
||||||
NAME="芒星DevOps指挥脚本"
|
|
||||||
VERSION="alpine"
|
|
||||||
|
|
||||||
echo "Welcome To NAME :${NAME}"
|
|
||||||
|
|
@ -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. **许可证**:使用 📄 表示法律和许可证。
|
||||||
Loading…
Reference in New Issue