From e6688d58b48444d631a5cdc1f0e60470d0d7bc19 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Fri, 13 Mar 2026 13:43:58 +0100 Subject: [PATCH 1/2] build(docker): create alpine based image --- Dockerfile.alpine | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Dockerfile.alpine diff --git a/Dockerfile.alpine b/Dockerfile.alpine new file mode 100644 index 0000000..9413060 --- /dev/null +++ b/Dockerfile.alpine @@ -0,0 +1,30 @@ +### Compile stage +FROM golang:1.26-alpine AS build-env + +WORKDIR /dockerbuild +ADD . . + +RUN apk add git + +RUN GIT_VERSION=$(git describe --tags --long --always || echo "dev-local") && \ + go mod tidy && \ + go build -ldflags "-X main.Version=$GIT_VERSION" -o cocoon ./cmd/cocoon + +### Run stage +FROM alpine:3 AS run + +RUN apk add dumb-init curl +ENTRYPOINT ["dumb-init", "--"] + +WORKDIR / +RUN mkdir -p data/cocoon +COPY --from=build-env /dockerbuild/cocoon / + +COPY ./init-keys.sh / +COPY ./create-initial-invite.sh / + +CMD ["/cocoon", "run"] + +LABEL org.opencontainers.image.source=https://github.com/haileyok/cocoon +LABEL org.opencontainers.image.description="Cocoon ATProto PDS" +LABEL org.opencontainers.image.licenses=MIT From 4d1f815ed18c66f92c3045b394e7e98d30d99791 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Fri, 13 Mar 2026 14:02:47 +0100 Subject: [PATCH 2/2] docs(readme): use alpine-based docker image --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5cfe1ce..cb4a7a6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Cocoon > [!WARNING] -I migrated and have been running my main account on this PDS for months now without issue, however, I am still not responsible if things go awry, particularly during account migration. Please use caution. +> I migrated and have been running my main account on this PDS for months now without issue, however, I am still not responsible if things go awry, particularly during account migration. Please use caution. Cocoon is a PDS implementation in Go. It is highly experimental, and is not ready for any production use. @@ -170,6 +170,27 @@ COCOON_S3_CDN_URL="https://cdn.example.com" > **Tip**: For Cloudflare R2, you can use the public bucket URL as the CDN URL. For AWS S3, you can use CloudFront or the S3 bucket URL directly if public access is enabled. +#### Alpine based image + +The default image is based on Debian. You can use the Alpine-based image if you prefer. + +> [!NOTE] +> Currently, we do not have pre-built Alpine-based image on the GitHub Container Registry. You have to build them locally. + +In the compose file, replace every `dockerfile: Dockerfile` by `dockerfile: Dockerfile.alpine`, e.g. +```yml +services: + cocoon: + build: + context: . + dockerfile: Dockerfile.alpine +``` + +You can also build the image locally with +```bash +docker build -f Dockerfile.alpine -t cocoon:alpine . +``` + ### Management Commands Create an invite code: