# Development Dockerfile with hot reload support FROM golang:1.24-alpine # Install development dependencies RUN apk add --no-cache \ git \ ca-certificates \ gcc \ musl-dev \ nodejs \ npm \ sqlite \ # For file watching inotify-tools # Set working directory WORKDIR /app # Install Air for Go hot reloading RUN go install github.com/air-verse/air@latest # Create backend directory RUN mkdir -p /app/backend # Copy backend go mod files first for better caching COPY backend/go.mod backend/go.sum /app/backend/ # Download Go dependencies WORKDIR /app/backend RUN go mod download # Copy Air configuration COPY backend/.air.toml /app/backend/ # Go back to app root WORKDIR /app # Copy the entire project COPY . . # Install frontend dependencies WORKDIR /app/frontend RUN npm install # Go back to app root WORKDIR /app # Expose ports for both backend and frontend EXPOSE 8080 5173 # Create a development startup script RUN echo '#!/bin/sh\n\ echo "🚀 Starting development environment..."\n\ echo "📡 Backend will be available at http://localhost:8080"\n\ echo "🎨 Frontend will be available at http://localhost:5173"\n\ echo ""\n\ # Start frontend in background\n\ cd /app/frontend && npm run dev &\n\ FRONTEND_PID=$!\n\ \n\ # Start backend with Air\n\ cd /app/backend && air\n\ \n\ # Cleanup on exit\n\ trap "kill $FRONTEND_PID" EXIT\n\ wait\n\ ' > /app/dev-start.sh && chmod +x /app/dev-start.sh # Set the development startup script as entrypoint ENTRYPOINT ["/app/dev-start.sh"]