normogen/backend/DOCKER-COMMANDS.md

1.5 KiB

Quick Fix Commands

The Problem

Docker is using cached layers from the old Dockerfile. Even though we updated the file, Docker's build cache still has the old FROM rust:latest with apk commands.

Solution Options

cd /home/asoliver/desarrollo/normogen/backend
docker compose -f docker-compose.dev.yml build --no-cache
docker compose -f docker-compose.dev.yml up -d

Option 2: Clear all Docker build cache first

# Clear Docker's build cache
docker builder prune -af

# Then rebuild
cd /home/asoliver/desarrollo/normogen/backend
docker compose -f docker-compose.dev.yml up -d --build

Option 3: Use the provided script

cd /home/asoliver/desarrollo/normogen/backend
chmod +x fix-docker-build.sh
./fix-docker-build.sh

Why This Happened

  • Docker caches build layers to speed up subsequent builds
  • When we changed FROM rust:latest to FROM rust:1.93-slim, Docker should have invalidated the cache
  • But sometimes Docker's cache gets confused, especially with latest tags
  • The --no-cache flag forces Docker to ignore all cached layers

What Changed in the Dockerfile

# OLD (cached):
FROM rust:latest
RUN apk add --no-cache musl-dev pkgconf openssl-dev...

# NEW (current):
FROM rust:1.93-slim
RUN apt-get update && apt-get install -y pkg-config libssl-dev...

The new image uses:

  • rust:1.93-slim (supports Edition 2024)
  • apt-get (Debian/Ubuntu package manager) instead of apk (Alpine)