cmc-sales/Dockerfile.prod.go

24 lines
658 B
Docker
Raw Normal View History

2025-08-22 02:38:13 -07:00
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
COPY go/go.mod go/go.sum ./
2025-08-22 02:38:13 -07:00
RUN go mod download
COPY go/ .
2025-08-22 02:38:13 -07:00
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
RUN sqlc generate
RUN go mod tidy
2025-08-22 02:38:13 -07:00
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server cmd/server/main.go
2025-11-22 15:39:57 -08:00
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o vault cmd/vault/main.go
2025-08-22 02:38:13 -07:00
FROM alpine:latest
2025-09-17 04:18:27 -07:00
RUN apk --no-cache add ca-certificates tzdata
2025-08-22 02:38:13 -07:00
WORKDIR /root/
COPY --from=builder /app/server .
2025-11-22 15:39:57 -08:00
COPY --from=builder /app/vault .
COPY go/templates ./templates
COPY go/static ./static
COPY go/.env.example .env
2025-08-22 02:38:13 -07:00
EXPOSE 8082
CMD ["./server"]