mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 05:21:57 +00:00
34 lines
609 B
Docker
34 lines
609 B
Docker
FROM golang:1.23-alpine AS builder
|
|
|
|
# Install tools build
|
|
RUN apk add --no-cache git curl bash build-base
|
|
|
|
WORKDIR /golang-boilerplate
|
|
|
|
# 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 /golang-boilerplate
|
|
|
|
# Copy binary hasil build
|
|
COPY --from=builder /golang-boilerplate/app .
|
|
|
|
# Copy file env example
|
|
COPY --from=builder /golang-boilerplate/.env.example .env
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["./app"]
|