# Dockerfile for SeaweedFS S3 IAM Integration Tests FROM golang:1.24-alpine AS builder # Install build dependencies RUN apk add --no-cache git make curl bash # Set working directory WORKDIR /app # Copy go modules first for better caching COPY go.mod go.sum ./ RUN go mod download # Copy source code COPY ../../../ . # Build SeaweedFS binary RUN go build -o weed ./main.go # Create runtime image FROM alpine:latest # Install runtime dependencies RUN apk add --no-cache \ bash \ curl \ ca-certificates \ && rm -rf /var/cache/apk/* # Create test user RUN addgroup -g 1000 seaweedfs && \ adduser -D -u 1000 -G seaweedfs seaweedfs # Set working directory WORKDIR /app # Copy built binary COPY --from=builder /app/weed /usr/local/bin/weed # Copy test files COPY . /app/test/s3/iam/ # Set permissions RUN chown -R seaweedfs:seaweedfs /app # Switch to test user USER seaweedfs # Set environment variables ENV WEED_BINARY=/usr/local/bin/weed ENV S3_PORT=8333 ENV FILER_PORT=8888 ENV MASTER_PORT=9333 ENV VOLUME_PORT=8080 ENV LOG_LEVEL=2 ENV TEST_TIMEOUT=30m # Expose ports EXPOSE 8333 8888 9333 8080 # Work in test directory WORKDIR /app/test/s3/iam # Health check HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=3 \ CMD curl -f http://localhost:8333/ || exit 1 # Default command runs the tests CMD ["make", "test"]