FROM golang:1.20-alpine # Install build dependencies RUN apk add --no-cache git tar gzip # Set up the working directory WORKDIR /app # Copy Go module files COPY go.mod ./ # Copy the source code COPY main.go ./ # Build FreeBSD binary RUN GOOS=freebsd GOARCH=amd64 CGO_ENABLED=0 go build -o tarballer-freebsd -ldflags="-s -w" # Build macOS ARM64 binary for local testing RUN GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o tarballer-darwin -ldflags="-s -w" # Build Linux binary for testing in container RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o tarballer-linux -ldflags="-s -w" # Copy Linux binary for use in the container RUN cp tarballer-linux /bin/tarballer && chmod +x /bin/tarballer # Copy test script COPY test/test.sh /bin/test.sh RUN chmod +x /bin/test.sh # Default working directory for running tests WORKDIR /workdir