自建notion博客搭建-Docker nobelium
date
May 19, 2022
slug
newservice-docker-notion-nobelium
status
Published
summary
新服务-
tags
service
type
Post
URL
Summary
- ‣
- 但这次用docker

Docker搭建

export DOCKER_PORT=18300
export DOCKER_PROJ=nobelium-notion
cd /data
git clone https://github.com/craigary/nobelium $DOCKER_PROJ
cd $DOCKER_PROJ
cat > NOTION_PAGE_ID <<EOF
put-in-your-notion-page-id
EOF
export NOTION_PAGE_ID=$(cat ./NOTION_PAGE_ID)
export IMAGE=nobelium:latest
# 需要把Dockerfile 的第一行去掉,不然后出错
# build with docker
docker build -t ${IMAGE} --build-arg NOTION_PAGE_ID .
docker run -dit -d \
--name=$DOCKER_PROJ \
--network npm_nginx_proxy_manager-network \
-p $DOCKER_PORT:3000 \
-e TZ=Asia/Hong_Kong \
-e NOTION_PAGE_ID=${NOTION_PAGE_ID} \
--restart always \
nobelium:latest
# or
cat > docker-compose.yml <<EOF
services:
nobelium:
#image: ghcr.io/craigary/nobelium:main # remote
image: nobelium:latest # local build
container_name: nobelium1
#ports:
# - "3000:3000"
environment:
NOTION_PAGE_ID: "${NOTION_PAGE_ID}" # 使用环境变量
networks:
default:
name: npm_nginx_proxy_manager-network
external: true
EOF
docker compose down; docker compose up -d; sleep 1s; docker compose logs -f
sleep 1s; docker logs -f $DOCKER_PROJ
# update
git pull
