diff --git a/.dockerignore b/.dockerignore index 5de2b96..6aa1f50 100644 --- a/.dockerignore +++ b/.dockerignore @@ -21,8 +21,6 @@ coverage.out README.md DEVELOPMENT.md SUMMARY.md -DOCKERHUB_SETUP.md -DOCKERHUB_QUICKSTART.md PROJECT_COMPLETE.md LICENSE diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index eb6328d..0000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Build and Push Docker Image - -on: - push: - branches: - - main - - master - tags: - - "v*.*.*" - pull_request: - branches: - - main - - master - workflow_dispatch: - -env: - DOCKER_IMAGE_NAME: s3dir - -jobs: - test: - name: Run Tests - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.25" - - - name: Run tests - run: go test -v -race ./... - - build-and-push: - name: Build and Push Docker Image - runs-on: ubuntu-latest - needs: test - if: github.event_name != 'pull_request' - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,prefix={{branch}}-,enable=${{ github.ref_type == 'branch' }} - type=raw,value=latest,enable={{is_default_branch}} - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Update Docker Hub description - uses: peter-evans/dockerhub-description@v4 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - repository: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }} - short-description: S3-Compatible Directory Server - Expose local directories via S3 API - readme-filepath: ./README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 704d9b7..e5b11bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,103 +1,107 @@ name: Release on: - push: - tags: - - "v*.*.*" - -permissions: - contents: write + workflow_dispatch: + inputs: + bump: + description: 'Version bump for the next dev cycle' + type: choice + default: minor + options: + - minor + - major jobs: - create-release: - name: Create Release + release: runs-on: ubuntu-latest + permissions: + contents: write + packages: write steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v5 + - uses: actions/setup-go@v5 with: - go-version: "1.25" + go-version-file: go.mod - name: Run tests - run: go test -v ./... + run: go test -race ./... - - name: Build binaries + - name: Resolve release version + id: version run: | - # Build for multiple platforms - GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o s3dir-linux-amd64 ./cmd/s3dir - GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o s3dir-linux-arm64 ./cmd/s3dir - GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o s3dir-darwin-amd64 ./cmd/s3dir - GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o s3dir-darwin-arm64 ./cmd/s3dir - GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o s3dir-windows-amd64.exe ./cmd/s3dir - - # Create archives - tar czf s3dir-linux-amd64.tar.gz s3dir-linux-amd64 - tar czf s3dir-linux-arm64.tar.gz s3dir-linux-arm64 - tar czf s3dir-darwin-amd64.tar.gz s3dir-darwin-amd64 - tar czf s3dir-darwin-arm64.tar.gz s3dir-darwin-arm64 - zip s3dir-windows-amd64.zip s3dir-windows-amd64.exe - - # Generate checksums - sha256sum s3dir-*.tar.gz s3dir-*.zip > checksums.txt - - - name: Generate release notes - id: release_notes + DEV_VERSION=$(cat VERSION) + PENDING_VERSION="${DEV_VERSION%-dev}" + MAJOR=$(echo $PENDING_VERSION | cut -d. -f1) + MINOR=$(echo $PENDING_VERSION | cut -d. -f2) + if [ "${{ inputs.bump }}" = "major" ]; then + RELEASE_VERSION="$((MAJOR + 1)).0.0" + NEXT_VERSION="$((MAJOR + 1)).1.0-dev" + else + RELEASE_VERSION="$MAJOR.$MINOR.0" + NEXT_VERSION="$MAJOR.$((MINOR + 1)).0-dev" + fi + echo "$RELEASE_VERSION" > VERSION + echo "release=$RELEASE_VERSION" >> $GITHUB_OUTPUT + echo "next=$NEXT_VERSION" >> $GITHUB_OUTPUT + + - name: Tag release run: | - VERSION=${GITHUB_REF#refs/tags/} - echo "version=$VERSION" >> $GITHUB_OUTPUT - - cat > release_notes.md << 'EOF' - ## S3Dir ${{ github.ref_name }} - - ### Installation - - #### Docker - ```bash - docker pull ${{ secrets.DOCKERHUB_USERNAME }}/s3dir:${{ github.ref_name }} - ``` - - #### Binary Download - Download the appropriate binary for your platform below. - - #### From Source - ```bash - git clone https://github.com/${{ github.repository }} - cd s3dir - git checkout ${{ github.ref_name }} - go build -o s3dir ./cmd/s3dir - ``` - - ### Quick Start - ```bash - # Extract binary (Linux/macOS example) - tar xzf s3dir-linux-amd64.tar.gz - - # Run - ./s3dir-linux-amd64 - ``` - - ### Changes - See commit history for detailed changes. + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add VERSION + git commit -m "chore: release v${{ steps.version.outputs.release }} [skip ci]" + git tag "v${{ steps.version.outputs.release }}" + git push + git push --tags + + - name: Bump to next dev version + run: | + echo "${{ steps.version.outputs.next }}" > VERSION + git add VERSION + git commit -m "chore: bump version to ${{ steps.version.outputs.next }} [skip ci]" + git push - ### Checksums - See `checksums.txt` for SHA256 checksums of all artifacts. - EOF + - name: Build binaries + run: | + mkdir -p dist + LDFLAGS="-s -w -X main.version=${{ steps.version.outputs.release }}" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -o dist/s3dir-linux-amd64 ./cmd/s3dir + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -o dist/s3dir-linux-arm64 ./cmd/s3dir + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o dist/s3dir-darwin-amd64 ./cmd/s3dir + CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "$LDFLAGS" -o dist/s3dir-darwin-arm64 ./cmd/s3dir + CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$LDFLAGS" -o dist/s3dir-windows-amd64.exe ./cmd/s3dir + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 + - name: Build and push Docker image + uses: docker/build-push-action@v6 with: - files: | - s3dir-*.tar.gz - s3dir-*.zip - checksums.txt - body_path: release_notes.md - draft: false - prerelease: false + context: . + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + VERSION=${{ steps.version.outputs.release }} + tags: | + ghcr.io/stut/s3dir:v${{ steps.version.outputs.release }} + ghcr.io/stut/s3dir:latest + + - name: Create release + run: | + gh release create "v${{ steps.version.outputs.release }}" \ + --title "v${{ steps.version.outputs.release }}" \ + --generate-notes \ + dist/* env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CLAUDE.md b/CLAUDE.md index f3a1f05..494be90 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -210,8 +210,19 @@ aws --endpoint-url=http://localhost:8000 s3 cp --debug large-file s3://bucket/ GitHub Actions workflows in `.github/workflows/`: - `ci.yml` - Tests on Ubuntu/macOS with Go 1.24/1.25 -- `docker-publish.yml` - Docker image builds -- `release.yml` - Release binaries for multiple platforms +- `release.yml` - Manually-dispatched release workflow + +### Versioning and releases + +The `VERSION` file holds the current version, `X.Y.Z-dev` during development. +The version is injected at build time via `-ldflags "-X main.version=..."` +(the Makefile and Dockerfile both do this; a plain `go build` shows "dev"). + +Releases are cut by running the Release workflow (workflow_dispatch) with a +`minor` or `major` bump. It strips the `-dev` suffix, commits and tags +`vX.Y.0`, bumps `VERSION` to the next `-dev` version, builds the platform +binaries and a multi-arch image pushed to `ghcr.io/stut/s3dir`, and creates a +GitHub release with generated notes. Do not tag releases by hand. **Important:** - All tests must pass with `-race` flag diff --git a/DOCKERHUB_QUICKSTART.md b/DOCKERHUB_QUICKSTART.md deleted file mode 100644 index e537cf7..0000000 --- a/DOCKERHUB_QUICKSTART.md +++ /dev/null @@ -1,79 +0,0 @@ -# DockerHub Quick Start - -## What You Need to Do - -### 1. Get Your DockerHub Credentials - -Create a DockerHub access token: -- Go to: https://hub.docker.com/settings/security -- Click "New Access Token" -- Name it: `GitHub Actions - s3dir` -- Copy the token (you won't see it again!) - -### 2. Add Secrets to GitHub - -Go to your GitHub repository → Settings → Secrets and variables → Actions - -Add these two secrets: - -| Secret Name | Value | -|-------------|-------| -| `DOCKERHUB_USERNAME` | Your DockerHub username | -| `DOCKERHUB_TOKEN` | The token you just created | - -### 3. Done! - -Push to GitHub and your Docker image will automatically build and publish to DockerHub! - -## What Happens Automatically - -✅ **On every push to main/master:** -- Runs all tests -- Builds Docker images for amd64 and arm64 -- Pushes to `yourusername/s3dir:latest` - -✅ **On version tags (e.g., `git tag v1.0.0`):** -- Same as above, plus: -- Pushes `yourusername/s3dir:1.0.0` -- Pushes `yourusername/s3dir:1.0` -- Pushes `yourusername/s3dir:1` - -## Testing Locally - -```bash -# Build -docker build -t s3dir:test . - -# Run -docker run -d -p 8000:8000 -v $(pwd)/data:/data s3dir:test -``` - -## Creating a Release - -```bash -# Tag and push -git tag v1.0.0 -git push origin v1.0.0 - -# GitHub Actions will automatically build and publish -``` - -## Using Published Image - -```bash -# Pull from DockerHub -docker pull yourusername/s3dir:latest - -# Run -docker run -d -p 8000:8000 -v $(pwd)/data:/data yourusername/s3dir:latest -``` - -## Troubleshooting - -**Build fails?** -1. Check GitHub Actions logs -2. Verify secrets are correct -3. Ensure DockerHub token hasn't expired - -**Need help?** -See [DOCKERHUB_SETUP.md](DOCKERHUB_SETUP.md) for detailed instructions. diff --git a/DOCKERHUB_SETUP.md b/DOCKERHUB_SETUP.md deleted file mode 100644 index d8d2f94..0000000 --- a/DOCKERHUB_SETUP.md +++ /dev/null @@ -1,216 +0,0 @@ -# DockerHub Setup Guide - -This guide explains how to configure GitHub Actions to automatically build and push Docker images to DockerHub. - -## Prerequisites - -1. A DockerHub account ([sign up here](https://hub.docker.com/signup)) -2. A GitHub repository with this project -3. GitHub repository admin access - -## Step-by-Step Setup - -### 1. Create DockerHub Access Token - -1. Log in to [DockerHub](https://hub.docker.com/) -2. Click on your username in the top-right corner -3. Select **Account Settings** -4. Click on **Security** in the left sidebar -5. Click **New Access Token** -6. Configure the token: - - **Description**: `GitHub Actions - s3dir` - - **Access permissions**: Select **Read, Write, Delete** -7. Click **Generate** -8. **IMPORTANT**: Copy the token immediately (it won't be shown again) - -### 2. Add Secrets to GitHub Repository - -1. Go to your GitHub repository -2. Click on **Settings** tab -3. In the left sidebar, click **Secrets and variables** → **Actions** -4. Click **New repository secret** -5. Add the following secrets: - -#### Secret 1: DOCKERHUB_USERNAME -- **Name**: `DOCKERHUB_USERNAME` -- **Value**: Your DockerHub username (e.g., `yourusername`) -- Click **Add secret** - -#### Secret 2: DOCKERHUB_TOKEN -- **Name**: `DOCKERHUB_TOKEN` -- **Value**: The access token you copied in Step 1 -- Click **Add secret** - -### 3. Create DockerHub Repository (Optional) - -The workflow will push to: `yourusername/s3dir` - -You can either: -- **Let GitHub Actions create it automatically** (recommended) -- **Create it manually**: - 1. Go to [DockerHub](https://hub.docker.com/) - 2. Click **Create Repository** - 3. Name: `s3dir` - 4. Visibility: Public or Private - 5. Click **Create** - -### 4. Verify Setup - -After pushing to GitHub, the workflow will: -1. Run all tests -2. Build multi-platform Docker images (amd64, arm64) -3. Push to DockerHub with appropriate tags - -### 5. Workflow Triggers - -The Docker build workflow triggers on: - -- **Push to main/master branch** → Builds with `latest` tag -- **Push tag matching `v*.*.*`** → Builds with version tags (e.g., `v1.0.0`, `1.0`, `1`) -- **Manual trigger** → Via GitHub Actions UI - -## Image Tags - -The workflow automatically creates multiple tags: - -### For branch pushes: -- `latest` (for main/master branch) -- `main` or `master` (branch name) -- `main-` (branch + commit) - -### For version tags (e.g., `v1.2.3`): -- `1.2.3` (full version) -- `1.2` (major.minor) -- `1` (major only) -- `latest` (if on default branch) - -## Example: Creating a Release - -To create a versioned release: - -```bash -# Tag your commit -git tag v1.0.0 -git push origin v1.0.0 -``` - -This will build and push: -- `yourusername/s3dir:1.0.0` -- `yourusername/s3dir:1.0` -- `yourusername/s3dir:1` -- `yourusername/s3dir:latest` - -## Using the Published Image - -Once published, users can pull and run your image: - -```bash -# Pull the image -docker pull yourusername/s3dir:latest - -# Run the container -docker run -d \ - -p 8000:8000 \ - -v $(pwd)/data:/data \ - --name s3dir \ - yourusername/s3dir:latest -``` - -## Troubleshooting - -### Workflow Fails with "Authentication Required" - -**Problem**: GitHub Actions can't authenticate with DockerHub - -**Solutions**: -1. Verify `DOCKERHUB_USERNAME` secret is correct (case-sensitive) -2. Verify `DOCKERHUB_TOKEN` is valid and not expired -3. Regenerate the DockerHub access token if needed -4. Ensure secrets are added to the correct repository - -### Workflow Fails with "Repository Not Found" - -**Problem**: DockerHub repository doesn't exist or is inaccessible - -**Solutions**: -1. Create the repository manually on DockerHub -2. Ensure the repository name matches: `yourusername/s3dir` -3. Check repository visibility settings - -### Build Fails on Specific Platform - -**Problem**: Build fails for `linux/arm64` or another platform - -**Solutions**: -1. Check the Dockerfile for platform-specific issues -2. Review build logs in GitHub Actions -3. Test locally with: `docker buildx build --platform linux/arm64 .` - -## Manual Testing - -Test the workflow locally using Docker Buildx: - -```bash -# Set up buildx -docker buildx create --use - -# Build multi-platform image -docker buildx build \ - --platform linux/amd64,linux/arm64 \ - -t yourusername/s3dir:test \ - --push \ - . -``` - -## Customization - -### Change Docker Image Name - -Edit `.github/workflows/docker-publish.yml`: - -```yaml -env: - DOCKER_IMAGE_NAME: your-custom-name # Change this -``` - -### Add Additional Tags - -Edit the `tags:` section in `docker-publish.yml`: - -```yaml -tags: | - type=raw,value=stable - type=raw,value=prod - # Add your custom tags here -``` - -### Build for Additional Platforms - -Edit the `platforms:` in `docker-publish.yml`: - -```yaml -platforms: linux/amd64,linux/arm64,linux/arm/v7 -``` - -## Security Best Practices - -1. **Use Access Tokens**: Never use your DockerHub password in GitHub secrets -2. **Limit Token Scope**: Create tokens with minimum required permissions -3. **Rotate Tokens**: Regenerate tokens periodically -4. **Monitor Usage**: Check DockerHub for unauthorized access -5. **Use Branch Protection**: Require reviews before merging to main - -## Additional Resources - -- [DockerHub Documentation](https://docs.docker.com/docker-hub/) -- [GitHub Actions Documentation](https://docs.github.com/en/actions) -- [Docker Buildx Documentation](https://docs.docker.com/buildx/working-with-buildx/) -- [GitHub Secrets Documentation](https://docs.github.com/en/actions/security-guides/encrypted-secrets) - -## Questions? - -If you encounter issues: -1. Check the GitHub Actions logs for detailed error messages -2. Review this guide for common solutions -3. Open an issue in the repository -4. Consult DockerHub and GitHub Actions documentation diff --git a/Dockerfile b/Dockerfile index 3b9244f..21439ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ -# Build stage -FROM golang:1.25-alpine AS builder +# Build stage - cross-compile for the target platform so nothing runs under +# emulation during multi-arch builds +FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder # Install build dependencies RUN apk add --no-cache git @@ -17,7 +18,9 @@ RUN go mod download COPY . . # Build the application -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-s -w' -o s3dir ./cmd/s3dir +ARG VERSION=dev +ARG TARGETOS TARGETARCH +RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-s -w -X main.version=${VERSION}" -o s3dir ./cmd/s3dir # Final stage FROM alpine:latest diff --git a/Makefile b/Makefile index ab60dce..4880862 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,10 @@ # Binary name BINARY_NAME=s3dir -# Build variables -VERSION?=dev -BUILD_TIME=$(shell date -u '+%Y-%m-%d_%H:%M:%S') -LDFLAGS=-ldflags "-s -w -X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME)" +# Build variables - the version comes from the VERSION file (X.Y.Z-dev during +# development; the release workflow strips the suffix when releasing) +VERSION := $(shell cat VERSION) +LDFLAGS=-ldflags "-s -w -X main.version=$(VERSION)" all: test build @@ -74,7 +74,7 @@ vet: ## docker-build: Build Docker image docker-build: @echo "Building Docker image..." - @docker build -t s3dir:$(VERSION) -t s3dir:latest . + @docker build --build-arg VERSION=$(VERSION) -t s3dir:$(VERSION) -t s3dir:latest . @echo "Docker build complete" ## docker-run: Run Docker container diff --git a/PROJECT_COMPLETE.md b/PROJECT_COMPLETE.md index a143124..cf0b327 100644 --- a/PROJECT_COMPLETE.md +++ b/PROJECT_COMPLETE.md @@ -29,13 +29,11 @@ A production-ready, S3-compatible directory server implemented in Go with compre - ✅ Race condition detection enabled - ✅ Edge case and error handling coverage -### Documentation (6 comprehensive guides) +### Documentation (4 comprehensive guides) 1. **README.md** - User guide with examples and use cases 2. **DEVELOPMENT.md** - Developer guide with architecture details -3. **DOCKERHUB_SETUP.md** - Complete DockerHub integration guide -4. **DOCKERHUB_QUICKSTART.md** - 5-minute setup reference -5. **examples/README.md** - Client usage examples -6. **SUMMARY.md** - Project statistics and overview +3. **examples/README.md** - Client usage examples +4. **SUMMARY.md** - Project statistics and overview ### Client Examples (4 languages) 1. **Bash** (`bash-client.sh`) - AWS CLI examples @@ -49,23 +47,17 @@ A production-ready, S3-compatible directory server implemented in Go with compre - ✅ Health checks and security (non-root user) - ✅ Multi-platform support (amd64, arm64) -### CI/CD (3 GitHub Actions workflows) +### CI/CD (2 GitHub Actions workflows) 1. **ci.yml** - Continuous Integration - Tests on Ubuntu & macOS - Multiple Go versions (1.21, 1.22) - Linting with golangci-lint - Multi-platform binary builds -2. **docker-publish.yml** - Docker Automation - - Automated Docker builds on push - - Multi-platform images (amd64, arm64) - - Smart tagging (latest, version, sha) - - Auto-publish to DockerHub - -3. **release.yml** - Release Management - - Automated releases on version tags +2. **release.yml** - Release Management + - Manually-dispatched releases - Cross-platform binaries (5 platforms) - - Checksums and GitHub releases + - Multi-arch images published to GHCR ### Build Automation - ✅ Makefile with 15+ targets @@ -126,34 +118,12 @@ aws --endpoint-url=http://localhost:8000 s3 ls s3://my-bucket/ --- -## 🔧 DockerHub Integration - -### What You Need to Do - -**Step 1:** Create DockerHub Access Token -- Go to https://hub.docker.com/settings/security -- Create token named "GitHub Actions - s3dir" -- Copy the token - -**Step 2:** Add GitHub Secrets -- Repository → Settings → Secrets → Actions -- Add `DOCKERHUB_USERNAME` (your username) -- Add `DOCKERHUB_TOKEN` (the token from step 1) - -**Step 3:** Push to GitHub -- GitHub Actions will automatically build and push to DockerHub! - -**Detailed Guide:** See `DOCKERHUB_SETUP.md` or `DOCKERHUB_QUICKSTART.md` - ---- - ## 📁 Project Structure ``` s3dir/ ├── .github/workflows/ # CI/CD automation │ ├── ci.yml # Continuous integration -│ ├── docker-publish.yml # Docker builds │ └── release.yml # GitHub releases ├── cmd/s3dir/ # Main application │ └── main.go @@ -166,7 +136,6 @@ s3dir/ ├── examples/ # Client examples (4 languages) ├── README.md # User documentation ├── DEVELOPMENT.md # Developer guide -├── DOCKERHUB_SETUP.md # DockerHub integration guide ├── Dockerfile # Container definition ├── docker-compose.yml # Multi-container setup ├── Makefile # Build automation @@ -197,7 +166,6 @@ All requirements completed: - [x] User-facing README with examples - [x] Developer-facing DEVELOPMENT guide - [x] API usage examples (4 languages) - - [x] DockerHub setup guide - [x] Inline code documentation - [x] **Best Practices** @@ -266,7 +234,7 @@ All requirements completed: - **Fully automated** CI/CD pipeline - **Multi-platform** Docker support - **Clean codebase** following Go best practices -- **Ready to use** - just add DockerHub secrets! +- **Ready to use** - just build and run! --- @@ -285,11 +253,10 @@ This project demonstrates: ## 🚢 Next Steps -1. **Set up DockerHub** (see DOCKERHUB_QUICKSTART.md) -2. **Push to GitHub** to trigger CI/CD -3. **Create a release** with `git tag v1.0.0` -4. **Share with users** via DockerHub -5. **Consider future enhancements**: +1. **Push to GitHub** to trigger CI/CD +2. **Create a release** by running the Release workflow +3. **Share with users** via GHCR +4. **Consider future enhancements**: - Multipart upload support - Object metadata persistence - Full AWS Signature V4 verification @@ -332,7 +299,6 @@ This project demonstrates: - **User Guide**: README.md - **Developer Guide**: DEVELOPMENT.md -- **DockerHub Setup**: DOCKERHUB_SETUP.md or DOCKERHUB_QUICKSTART.md - **Examples**: examples/README.md - **Issues**: Use GitHub Issues @@ -347,7 +313,7 @@ This is a complete, production-ready S3-compatible server with: - Automated CI/CD - Multi-platform support -**The project is ready to use immediately** - just build and run, or set up DockerHub automation for seamless deployment! +**The project is ready to use immediately** - just build and run! --- diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..b6bb93f --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.3.0-dev diff --git a/cmd/s3dir/main.go b/cmd/s3dir/main.go index e424c0a..4675f02 100644 --- a/cmd/s3dir/main.go +++ b/cmd/s3dir/main.go @@ -15,6 +15,9 @@ import ( "github.com/stut/s3dir/pkg/storage" ) +// version is injected at build time via -ldflags "-X main.version=..." +var version = "dev" + func main() { // Load configuration cfg, err := config.Load() @@ -25,6 +28,7 @@ func main() { // Print startup information fmt.Printf("S3Dir - S3-Compatible Directory Server\n") fmt.Printf("========================================\n") + fmt.Printf("Version: %s\n", version) fmt.Printf("Data Directory: %s\n", cfg.DataDir) fmt.Printf("Listen Address: %s\n", cfg.Address()) fmt.Printf("Authentication: %v\n", cfg.EnableAuth)