Files
dummy-service-workflow/Dockerfile
bapung 24ea8bf578
Some checks failed
Build Heavy Service / build-and-package (push) Has been cancelled
add heavy build
2025-12-23 11:00:33 +08:00

34 lines
818 B
Docker

FROM golang:1.23-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git
# Copy module files first to leverage Docker cache for dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source code
COPY . .
# Argument to control the number of generated files (default to 5000 for a moderate delay)
ARG FILE_COUNT=5000
# Generate the dummy source code to simulate a large codebase
RUN echo "Generating $FILE_COUNT dummy files..." && \
go run gen.go -count $FILE_COUNT
# Build the application
# Using -a to force rebuilding of all packages to simulate a fresh, heavy build
RUN echo "Starting heavy build..." && \
go build -a -o app .
# Final stage: Create a minimal image
FROM alpine:latest
WORKDIR /root/
COPY --from=builder /app/app .
CMD ["./app"]