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 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: