40 lines
947 B
Plaintext
40 lines
947 B
Plaintext
# backend/Dockerfile.dev
|
|
# Development Dockerfile with hot reload support
|
|
|
|
# Stage 1: Base image with Go tools
|
|
FROM golang:1.25-alpine AS base
|
|
|
|
# Install developement tools
|
|
# - git: Required for go get
|
|
# - gcc, musl-dev: Required for CGO (some packages need C compiler)
|
|
# - air: Hot reload tool for GO
|
|
RUN apk add --no-cache \
|
|
git \
|
|
gcc \
|
|
musl-dev && \
|
|
go install github.com/air-verse/air@latest
|
|
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Stage 2: Development environment
|
|
FROM base as development
|
|
|
|
# Copy dependency files first (for layer caching)
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download dependencies
|
|
# This layer is cached unless go.mod or go.sum changes
|
|
RUN go mod download
|
|
|
|
# Copy Air configuration
|
|
|
|
COPY .air.toml ./
|
|
# EXPOSE port 8080 for API
|
|
# This is documentation only - doesn't actually expose port
|
|
EXPOSE 8080
|
|
|
|
# Use Air for hot reload
|
|
# Air watches for file changes and recompiles automatically
|
|
CMD [ "air", "-c", ".air.toml" ] |