转载自:院长技术

日期:2024-02-29 北京

项目地址:https://fastposter.net/

部署

  • 下载 Fastposter 镜像

[root@Dean ~]# docker pull  fastposter/fastposter
latest: Pulling from fastposter/fastposter
7d63c13d9b9b: Already exists 
6ad2a11ca37b: Pull complete 
8076cdef4689: Pull complete 
0ba90f5a7dd0: Pull complete 
27c191df269f: Pull complete 
e332e26a6509: Pull complete 
b6aa2cfacc25: Pull complete 
Digest: sha256:0d1c173c7bc5ef6b51a815a995f06dd89b4902e4773be98687259134cf6ea267
Status: Downloaded newer image for fastposter/fastposter:latest

创建容器:

docker run -itd --name fastposter -p 5000:5000 fastposter/fastposter
  • 公网部署

部署到公网环境,需要设置变量POSTER_URI_PREFIX,把127.0.0.1替换成服务器的IP即可

注意,POSTER_URI_PREFIX=http://127.0.0.1:5000/ 后不要带#号。

docker run -it \ 
 -e POSTER_URI_PREFIX=http://127.0.0.1:5000/ \
 --name fastposter \
 -p 5000:5000 fastposter/fastposter

数据持久性

持久化数据和图片资源,需要挂载目录-v $PWD/data:/app/data

docker run -it \
  -v $PWD/data:/app/data \
  --name fastposter \
  -p 5000:5000 fastposter/fastposter

docker-compose 完整配置

version: '3'
services:
  fastposter:
    container_name: fastposter
    image: fastposter/fastposter
    restart: on-failure
    ports:
      - 5000:5000
    volumes:
      - ./data:/app/data
    environment:
      TZ: Asia/Shanghai
      TOKEN: ApfrIzxCoK1DwNZOEJCwlrnv6QZ0PCdv
      POSTER_URI_PREFIX: http://127.0.0.1:5000/

networks:
  default:
    name: 'fastposter-net'