cmc-sales/Dockerfile.local.go

43 lines
898 B
Go

FROM golang:1.24-alpine
WORKDIR /app
# Install Chromium and dependencies for chromedp
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
# Set environment variable for chromedp to find chromium
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/bin/chromium-browser
# Copy go.mod and go.sum first
COPY go/go.mod go/go.sum ./
# Download dependencies
RUN go mod download
# Install Air for hot reload (pinned to v1.52.3 for Go 1.24 compatibility)
RUN go install github.com/air-verse/air@v1.52.3
# Install sqlc for SQL code generation
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
# Copy source code
COPY go/ .
# Generate sqlc code
RUN sqlc generate
# Ensure static assets are available
COPY go/static ./static
# Copy Air config
COPY go/.air.toml .air.toml
EXPOSE 8080
CMD ["air", "-c", ".air.toml"]