-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.space.kts
More file actions
21 lines (18 loc) · 809 Bytes
/
Copy path.space.kts
File metadata and controls
21 lines (18 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
job("Build and Deploy") {
container(image = "docker") {
env["DOCKER_USERNAME"] = "{{ project:DOCKER_USERNAME }}"
env["DOCKER_PASSWORD"] = "{{ project:DOCKER_PASSWORD }}"
shellScript {
content = """
# 构建 Docker 镜像
docker build -t nginx-kargobang:latest .
# 推送镜像到 Docker 仓库
echo "${'$'}DOCKER_PASSWORD" | docker login -u "${'$'}DOCKER_USERNAME" --password-stdin
docker tag nginx-kargobang:latest mrowenovo/nginx-kargobang:latest
docker push mrowenovo/nginx-kargobang:latest
# 使用 docker-compose 启动生产环境容器
docker-compose -f docker-compose.yaml up -d
"""
}
}
}