Files
codimd/docker-compose.yml
Timmy 8af2f6f3b9 feat: bind CodiMD to all network interfaces (0.0.0.0)
Change port binding from 127.0.0.1 to 0.0.0.0 to allow external access.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
2026-03-17 15:15:43 +08:00

66 lines
1.7 KiB
YAML

services:
database:
image: postgres:16-alpine
container_name: codimd-postgres
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
# PostgreSQL security settings
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
volumes:
- ./pgdata:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- codimd-network
# Security: restrict to internal network only
ports: []
# Additional security options
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp
- /var/run/postgresql
codimd:
image: hackmdio/hackmd:2.6.1
container_name: codimd-app
environment:
- CMD_DB_URL=${CMD_DB_URL}
- CMD_DOMAIN=${CMD_DOMAIN}
- CMD_URL_ADDPORT=${CMD_URL_ADDPORT}
- CMD_PROTOCOL_USESSL=${CMD_PROTOCOL_USESSL}
- CMD_USECDN=false
- CMD_SESSION_SECRET=${CMD_SESSION_SECRET}
- CMD_SESSION_LIFETIME=1209600000
- CMD_PORT=3000
depends_on:
database:
condition: service_healthy
ports:
- "0.0.0.0:3000:3000"
volumes:
- ./upload-data:/home/hackmd/app/public/uploads
restart: always
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- codimd-network
security_opt:
- no-new-privileges:true
networks:
codimd-network:
driver: bridge
internal: false