mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-10 11:54:37 +00:00
Restruct
This commit is contained in:
19
15_cases/ci/drone/demo/.drone.yml
Normal file
19
15_cases/ci/drone/demo/.drone.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build
|
||||
steps:
|
||||
- name: build
|
||||
image: golang:alpine
|
||||
pull: if-not-exists # always never
|
||||
environment:
|
||||
KEY: VALUE
|
||||
commands:
|
||||
- echo $KEY
|
||||
- pwd
|
||||
- ls
|
||||
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
|
||||
- ./app
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
22
15_cases/ci/drone/demo/README.md
Normal file
22
15_cases/ci/drone/demo/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Drone CI Demo 项目
|
||||
|
||||
这是一个基于 Go 语言编写的简单 Web 应用示例,用于演示 Drone CI 的持续集成流程。
|
||||
|
||||
## 目录结构
|
||||
|
||||
* `app.go`: 简单的 Go Web 服务器代码。
|
||||
* `.drone.yml`: Drone CI 的配置文件,定义了构建和测试流程。
|
||||
* `Dockerfile`: 定义了如何将该应用构建为 Docker 镜像。
|
||||
|
||||
## 如何运行
|
||||
|
||||
1. 确保本地已安装 Docker 环境。
|
||||
2. 进入本目录构建镜像:
|
||||
```bash
|
||||
docker build -t drone-demo-app .
|
||||
```
|
||||
3. 运行容器:
|
||||
```bash
|
||||
docker run -p 8080:8080 drone-demo-app
|
||||
```
|
||||
4. 访问 `http://localhost:8080` 查看效果。
|
||||
7
15_cases/ci/drone/demo/app.go
Normal file
7
15_cases/ci/drone/demo/app.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main(){
|
||||
fmt.Printf("Hello World!\n");
|
||||
}
|
||||
Reference in New Issue
Block a user