Files
lti-api/Dockerfile.prod
T
2025-09-25 11:08:01 +07:00

34 lines
565 B
Docker

FROM golang:1.23-alpine AS builder
# Install tools build
RUN apk add --no-cache git curl bash build-base
WORKDIR /lti-api
# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build binary dari entrypoint (cmd/api/main.go)
RUN CGO_ENABLED=0 GOOS=linux go build -o app ./cmd/api
FROM alpine:3.20
# Install tools
RUN apk add --no-cache curl
WORKDIR /lti-api
# Copy binary hasil build
COPY --from=builder /lti-api/app .
# Copy file env example
COPY --from=builder /lti-api/.env.example .env
EXPOSE 8080
CMD ["./app"]