对教程《Docker系列 WordPress系列 自建随机图API之静态壁纸 - Bensz》中的个人博客随机图API进行Docker化,使其布署更加方便。特性:
- 基于PHP
- 依据访问设备类型(PC/iPad vs. Mobile)选择不同壁纸
- 克隆本仓库
git clone https://github.com/huangwb8/random-image.git- 新建镜像
random-image
docker build -t random-image .- 自定义
img.txt和img_mobile.txtimg.txt是PC端壁纸的URL集合,img_mobile.txt是手机端壁纸的URL集合- 通过在URL前面添加
#可沉默该URL,即不进入随机选择
- 通过docker-compose布署
docker-compose up -d- 假设用
https://randomimage.hwb0307.com反代了该容器的局域网http://ip:1000,将链接https://randomimage.hwb0307.com添加到个人博客的背景图片中即可。以WordPress主题Argon为例,添加位置如下:
- 普通用户可按需修改
img.txt、img_mobile.txt和docker-compose.yml - 高级用户可按需修改
index.php

