first modular docker files system

This commit is contained in:
BlackSigkill 2026-02-06 17:44:18 +01:00
parent 8e8225c26e
commit 6d8079f763
5 changed files with 133 additions and 0 deletions

32
.dockerignore Normal file
View file

@ -0,0 +1,32 @@
# Dependencies
node_modules
# Build output
dist
# Git
.git
.github
# IDE
.idea
.vscode
# OS
.DS_Store
# Environment
.env
.env.*
# Documentation
*.md
license
# Docker
Dockerfile*
docker-compose*.yml
.dockerignore
# Other
*.log

12
.env.example Normal file
View file

@ -0,0 +1,12 @@
# Monochrome Docker Configuration
# Copy to .env and edit: cp .env.example .env
# --- Monochrome ---
MONOCHROME_PORT=3000
MONOCHROME_DEV_PORT=5173
# --- PocketBase (only used with --profile pocketbase) ---
POCKETBASE_PORT=8090
PB_ADMIN_EMAIL=admin@example.com
PB_ADMIN_PASSWORD=changeme
TZ=UTC

3
.gitignore vendored
View file

@ -3,3 +3,6 @@ dist
.DS_Store
*.local
.vite
# Docker
.env

15
Dockerfile.dev Normal file
View file

@ -0,0 +1,15 @@
# Development Dockerfile for hot-reloading
FROM oven/bun:canary-alpine
WORKDIR /app
# Copy package files first for caching
COPY package.json bun.lock ./
# Install dependencies
RUN bun install
# Expose Vite dev server port
EXPOSE 5173
CMD ["bun", "run", "dev", "--", "--host", "0.0.0.0"]

71
docker-compose.yml Normal file
View file

@ -0,0 +1,71 @@
services:
# Production frontend -- always runs
monochrome:
build:
context: .
dockerfile: Dockerfile
container_name: monochrome
ports:
- "${MONOCHROME_PORT:-3000}:4173"
restart: unless-stopped
networks:
- monochrome-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4173/"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
# PocketBase backend -- only starts with: docker compose --profile pocketbase up -d
pocketbase:
image: ghcr.io/muchobien/pocketbase:latest
container_name: monochrome-pocketbase
profiles:
- pocketbase
restart: unless-stopped
environment:
PB_ADMIN_EMAIL: ${PB_ADMIN_EMAIL:-admin@example.com}
PB_ADMIN_PASSWORD: ${PB_ADMIN_PASSWORD:-changeme}
TZ: ${TZ:-UTC}
ports:
- "${POCKETBASE_PORT:-8090}:8090"
volumes:
- pb_data:/pb_data
- pb_public:/pb_public
- pb_hooks:/pb_hooks
command: serve --http=0.0.0.0:8090
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
- monochrome-network
# Development server -- only starts with: docker compose --profile dev up -d
monochrome-dev:
build:
context: .
dockerfile: Dockerfile.dev
container_name: monochrome-dev
profiles:
- dev
ports:
- "${MONOCHROME_DEV_PORT:-5173}:5173"
volumes:
- .:/app
- /app/node_modules
command: bun run dev -- --host 0.0.0.0
networks:
- monochrome-network
networks:
monochrome-network:
driver: bridge
volumes:
pb_data:
pb_public:
pb_hooks: