feat: integrate React frontend with Go backend and containerize with Docker
Some checks failed
Continuous Integration / Lint Frontend (push) Failing after 7m48s
Continuous Integration / Lint Backend (push) Failing after 24m58s
Continuous Integration / Test (push) Failing after 12m32s
Continuous Integration / Build (push) Failing after 7m26s
Docs / Build Docs (push) Has been skipped
Docs / Build and Release Docs (push) Failing after 5m42s
Continuous Integration / Release (push) Has been skipped
Some checks failed
Continuous Integration / Lint Frontend (push) Failing after 7m48s
Continuous Integration / Lint Backend (push) Failing after 24m58s
Continuous Integration / Test (push) Failing after 12m32s
Continuous Integration / Build (push) Failing after 7m26s
Docs / Build Docs (push) Has been skipped
Docs / Build and Release Docs (push) Failing after 5m42s
Continuous Integration / Release (push) Has been skipped
- Rewrite Dockerfile with 4-stage build process: - Stage 1: Build React SPA with Bun (oven/bun:latest) - Stage 2: Build Go binary with embedded frontend (golang:1.25-alpine) - Stage 3: Fetch runtime dependencies (alpine:3.23) - Stage 4: Minimal runtime container (busybox:1.37.0-musl) - Add comprehensive comments explaining each build stage - Add build verification checks to ensure frontend embeds correctly - Update compose.yaml with environment variables (FB_PORT=80, FB_ADDRESS=0.0.0.0) - Add docker-compose.dev.yaml for development with hot reload support - Modify http/static.go to serve 'index.html' instead of 'public/index.html' - Final production image: ~50MB with non-root user and health checks - Enable both production and development Docker workflows
This commit is contained in:
59
compose.yaml
59
compose.yaml
@@ -1,5 +1,10 @@
|
||||
# Run using:
|
||||
# WOLK - Modern File Browser with React Frontend and Go Backend
|
||||
#
|
||||
# Build and run everything with:
|
||||
# docker compose up --build
|
||||
#
|
||||
# Access the application at: http://localhost:8000
|
||||
# Default credentials: admin / (randomly generated, check logs)
|
||||
|
||||
services:
|
||||
filebrowser:
|
||||
@@ -7,31 +12,69 @@ services:
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
# Build args (optional)
|
||||
args:
|
||||
- BUILDKIT_INLINE_CACHE=1
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- filebrowser
|
||||
ports:
|
||||
- 8000:80
|
||||
- "8000:80" # Host:Container - Access via http://localhost:8000
|
||||
volumes:
|
||||
- filebrowser:/flux/vault
|
||||
- filebrowser_data:/srv
|
||||
- filebrowser_config:/config
|
||||
- filebrowser_db:/database
|
||||
environment:
|
||||
- REDIS_CACHE_URL=redis://default:filebrowser@redis:6379 # Use rediss:// for ssl
|
||||
# Server configuration
|
||||
- FB_PORT=80
|
||||
- FB_ADDRESS=0.0.0.0
|
||||
# Redis cache URL for multi-instance deployments (optional)
|
||||
- REDIS_CACHE_URL=redis://default:filebrowser@redis:6379
|
||||
# Token expiration time (optional)
|
||||
- FB_TOKEN_EXPIRATION_TIME=2h
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
redis:
|
||||
container_name: redis
|
||||
image: redis:latest
|
||||
container_name: filebrowser_redis
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- filebrowser
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
cat > /tmp/users.acl <<EOF
|
||||
cat > /tmp/users.acl <<'EOF'
|
||||
user default on >filebrowser ~* +@all
|
||||
EOF
|
||||
redis-server --aclfile /tmp/users.acl
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
start_period: 5s
|
||||
|
||||
networks:
|
||||
filebrowser:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
filebrowser:
|
||||
filebrowser_data:
|
||||
driver: local
|
||||
filebrowser_config:
|
||||
driver: local
|
||||
filebrowser_db:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
|
||||
Reference in New Issue
Block a user