47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
version: '3'
|
|
|
|
services:
|
|
wf4:
|
|
image: oven/bun:latest
|
|
container_name: wf4
|
|
working_dir: /app
|
|
ports:
|
|
- "1337:3000"
|
|
volumes:
|
|
- wf4_data:/app
|
|
environment:
|
|
- NODE_ENV=production
|
|
command: >
|
|
sh -c "
|
|
# Install git and curl if not already installed
|
|
if ! command -v git &> /dev/null || ! command -v curl &> /dev/null; then
|
|
echo 'Installing required packages...'
|
|
apt-get update && apt-get install -y git curl
|
|
fi &&
|
|
|
|
# Clone repository if not already cloned
|
|
if [ ! -d /app/.git ]; then
|
|
echo 'Cloning repository...'
|
|
git clone https://git.webfussel.de/webfussel/wf4 /tmp/wf4 &&
|
|
cp -r /tmp/wf4/. /app/ &&
|
|
rm -rf /tmp/wf4
|
|
fi &&
|
|
|
|
# Install dependencies and start application
|
|
echo 'Installing dependencies...' &&
|
|
bun install &&
|
|
echo 'Building application...' &&
|
|
bun run build &&
|
|
echo 'Starting application...' &&
|
|
bun .output/server/index.mjs
|
|
"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:1337"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
volumes:
|
|
wf4_data:
|