Simplify: Remove cargo-watch from Docker dev build

cargo-watch dependencies require Rust 1.85+ and edition2024.
For development, we can simply use 'cargo run' which works fine.
The server can be restarted with docker compose restart.
This commit is contained in:
goose 2026-02-15 12:03:28 -03:00
parent ea6f29238c
commit 5e20e802f3
2 changed files with 11 additions and 29 deletions

View file

@ -1,11 +1,9 @@
FROM rust:1.83-alpine
WORKDIR /app
RUN apk add --no-cache musl-dev pkgconf openssl-dev curl wget git pkgconfig
# Pin cargo-watch to version 8.4.0 which doesn't require edition2024
RUN cargo install cargo-watch --version 8.4.0
COPY Cargo.toml ./
RUN mkdir src && echo 'fn main() {}' > src/main.rs
RUN cargo build && rm -rf src
COPY src ./src
EXPOSE 8000
CMD ["cargo-watch", "-x", "run"]
CMD ["cargo", "run"]

36
thoughts/test-docker-build.sh Normal file → Executable file
View file

@ -1,41 +1,25 @@
#!/bin/bash
set -e
echo "🧪 Testing Docker build with cargo-watch 8.4.0..."
echo ""
echo "🔧 Cleaning up old containers..."
cd backend
echo "📋 Step 1: Clean up old containers and images..."
docker compose -f docker-compose.dev.yml down 2>/dev/null || true
docker rmi normogen-backend-dev 2>/dev/null || true
echo "✓ Cleanup complete"
echo ""
echo "📋 Step 2: Building Docker image (this will take a few minutes)..."
echo "🗑️ Removing old image..."
docker rmi normogen-backend-dev 2>/dev/null || true
echo "🏗️ Building Docker image (this may take a few minutes)..."
docker compose -f docker-compose.dev.yml build --no-cache
echo ""
echo "✓ Build complete!"
echo ""
echo "📋 Step 3: Starting services..."
echo "🚀 Starting services..."
docker compose -f docker-compose.dev.yml up -d
echo ""
echo "📋 Step 4: Waiting for services to be ready..."
echo "⏳ Waiting for server to be ready..."
sleep 5
echo ""
echo "📋 Step 5: Checking service status..."
echo "📊 Container status:"
docker compose -f docker-compose.dev.yml ps
echo ""
echo "📋 Step 6: Showing backend logs..."
docker compose -f docker-compose.dev.yml logs --tail=20 backend
echo ""
echo "✅ Done! Server should be running on http://localhost:6800"
echo ""
echo "To view logs: docker compose -f docker-compose.dev.yml logs -f backend"
echo "To stop: docker compose -f docker-compose.dev.yml down"
echo "📋 Server logs (ctrl+c to exit):"
docker compose -f docker-compose.dev.yml logs -f backend