22 lines
538 B
Go
22 lines
538 B
Go
FROM golang:1.24-alpine AS builder
|
|
|
|
RUN apk add --no-cache git
|
|
WORKDIR /app
|
|
COPY go/go.mod go/go.sum ./
|
|
RUN go mod download
|
|
COPY go/ .
|
|
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
|
|
RUN sqlc generate
|
|
RUN go mod tidy
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server cmd/server/main.go
|
|
|
|
FROM alpine:latest
|
|
RUN apk --no-cache add ca-certificates tzdata
|
|
WORKDIR /root/
|
|
COPY --from=builder /app/server .
|
|
COPY go/templates ./templates
|
|
COPY go/static ./static
|
|
COPY go/.env.example .env
|
|
EXPOSE 8082
|
|
CMD ["./server"]
|