evanw-esbuild
SUCCESS
2m 32s
History Source
SummaryIterations1Transcript3Dockerfile
Dockerfile28 lines · 623 chars
FROM golang:1.13-buster AS builder
WORKDIR /src

# Cache Go module downloads by first copying go.mod and go.sum
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the source
COPY . ./

ENV CGO_ENABLED=0

# Build esbuild binary
RUN go build -trimpath -ldflags "-s -w" -o esbuild ./cmd/esbuild

# Final runtime image
FROM debian:bullseye-slim

# Install CA certificates for HTTPS requests at runtime
RUN apt-get update && \
    apt-get install -y --no-install-recommends ca-certificates && \
    rm -rf /var/lib/apt/lists/*

COPY --from=builder /src/esbuild /esbuild
RUN chmod +x /esbuild

ENTRYPOINT ["/esbuild"]