- Rename project from 'bookmann' to 'shelf' - Move all backend/ contents to root level (flatten structure) - Update Go module name from 'bookmann' to 'shelf' - Update all import paths to use new 'shelf' module - Update Dockerfile to work without backend/ subdirectory - Update docker-compose.yml to use new structure and rename containers - Update .gitignore for new file paths - Update README.md with new project name and structure - Regenerate database code with new module imports
40 lines
733 B
Docker
40 lines
733 B
Docker
# Build stage
|
|
FROM golang:1.25-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install sqlc
|
|
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Download dependencies
|
|
RUN go mod tidy
|
|
|
|
# Generate sqlc code
|
|
RUN sqlc generate
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main ./cmd/server
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates
|
|
WORKDIR /root/
|
|
|
|
# Copy the binary from builder stage
|
|
COPY --from=builder /app/main .
|
|
|
|
# Copy migrations (if needed for initialization)
|
|
COPY --from=builder /app/migrations ./migrations
|
|
|
|
# Copy templates
|
|
COPY --from=builder /app/templates ./templates
|
|
|
|
# Expose port
|
|
EXPOSE 8765
|
|
|
|
# Run the binary
|
|
CMD ["./main"] |