diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index b6e2af4..1b6e2fa 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -7,6 +7,7 @@ on: permissions: contents: write + packages: write jobs: goreleaser: @@ -22,6 +23,16 @@ jobs: with: go-version-file: 'go.mod' + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: @@ -30,3 +41,4 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + Owner: ${{ github.repository_owner }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index fddb2aa..f280493 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -8,6 +8,9 @@ version: 2 +env: + - Owner={{ .Env.Owner }} + before: hooks: # You may remove this if you don't use go modules. @@ -43,6 +46,20 @@ archives: - goos: windows formats: [zip] +dockers_v2: + - id: clawlet + dockerfile: Dockerfile.goreleaser + ids: + - clawlet + images: + - "ghcr.io/{{ .Env.Owner }}/clawlet" + tags: + - "{{ .Tag }}" + - "latest" + platforms: + - linux/amd64 + - linux/arm64 + changelog: sort: asc filters: diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser new file mode 100644 index 0000000..4a124a1 --- /dev/null +++ b/Dockerfile.goreleaser @@ -0,0 +1,15 @@ +FROM alpine:latest + +ARG TARGETPLATFORM + +RUN apk add --no-cache ca-certificates + +COPY $TARGETPLATFORM/clawlet /usr/local/bin/clawlet + +# Create config directory +RUN mkdir -p /root/.clawlet + +EXPOSE 18790 + +ENTRYPOINT ["clawlet"] +CMD ["status"] diff --git a/README.md b/README.md index a581c20..5222f2d 100644 --- a/README.md +++ b/README.md @@ -320,7 +320,28 @@ clawlet cron add --message "ping" --every 600 --channel slack --to U012345 ``` ## 🐳 Docker -Build and run clawlet in a container: +### Using Pre-built Images + +Pre-built images are available on GitHub Container Registry: + +```yaml +# docker-compose.yml +services: + clawlet: + image: ghcr.io/mosaxiv/clawlet:latest + volumes: + - ~/.clawlet:/root/.clawlet + ports: + - "18790:18790" + command: gateway + restart: unless-stopped +``` + +```bash +docker compose up -d +``` + +### Building Locally ```bash # Build the image