39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
---
|
|
services:
|
|
stock:
|
|
image: stock:latest # 指定了镜像名
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: stock
|
|
restart: unless-stopped
|
|
|
|
platform: linux/x86_64 # 强制使用 x86_64 平台
|
|
|
|
networks:
|
|
- devops # 你之前创建的 devops 网络
|
|
|
|
environment:
|
|
- TZ=Asia/Shanghai
|
|
|
|
ports:
|
|
- "1080:80"
|
|
|
|
volumes:
|
|
- ~/Documents/codes/common:/root/projects # 挂载git工程目录
|
|
# mkdir -p ~/dockers/stock/{hostdir,config}
|
|
- ~/dockers/stock/hostdir:/root/hostdir # 挂载一个通用的主机目录
|
|
- ~/dockers/stock/config:/root/config # 挂载一个通用的主机目录
|
|
- ~/dockers/sharedata:/root/sharedata # 挂载一个docker之间共享的目录
|
|
|
|
- ~/dockers/stock/.ssh:/root/.ssh # 允许 SSH 访问 git 仓库
|
|
# touch ~/dockers/stock/.gitconfig
|
|
- ~/dockers/stock/.gitconfig:/root/.gitconfig # 共享 Git 配置文件
|
|
|
|
stdin_open: true
|
|
tty: true
|
|
|
|
networks:
|
|
devops:
|
|
external: true # 你已有的 devops 网络
|