28 lines
641 B
Docker
28 lines
641 B
Docker
# Development Dockerfile with hot reload
|
|
FROM golang:1.24-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install air for hot reload
|
|
# Use GOTOOLCHAIN=auto to allow Go to download a newer toolchain if needed
|
|
ENV GOTOOLCHAIN=auto
|
|
RUN go install github.com/air-verse/air@latest
|
|
|
|
# Install migrate for database migrations
|
|
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
|
|
|
|
# Copy go mod files first for caching
|
|
COPY go.mod ./
|
|
RUN go mod download
|
|
|
|
# Copy source code (will be overridden by volume mount)
|
|
COPY . .
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /app/data
|
|
|
|
EXPOSE 8080
|
|
|
|
# Use air for hot reload
|
|
CMD ["air", "-c", ".air.toml"]
|