Files
Warp/Docker-AIO/Dockerfile.PocketBase.s3
tajniak81andClaude Opus 5.5 332916e9db Docker-AIO: PocketBase image with media in an external S3 bucket
Dockerfile.PocketBase.s3 is the PocketBase all-in-one image with S3
turned on: media goes to an existing bucket on WARP_PB_S3_ENDPOINT
(AWS, MinIO, or a SeaweedFS elsewhere), and the database stays in
/data/pb_data. The compose files require the endpoint and key pair,
default the bucket to warp, the region to us-east-1 and path style
to true, and add host.docker.internal so the endpoint can be on the
Docker host. Modelled on DriverVault's external-S3 compose files.

The entrypoint now waits up to 30 seconds for an external S3 endpoint
to answer and stops if it doesn't, instead of starting a homeserver
that would fail on its first upload. WARP_PB_S3_FORCE_PATH_STYLE is
left empty in .env.example so the S3 file's default applies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:45:01 +02:00

121 lines
4.6 KiB
Docker

# warp-aio-pocketbase-s3 — the homeserver, the admin panel and the web client
# in one image, on PocketBase, with media in an S3 bucket that already exists
# somewhere else: AWS, MinIO, a SeaweedFS on another host. The database stays
# in /data/pb_data. For a SeaweedFS that comes up inside the container, see
# Dockerfile.PocketBase.SeaweedFS.
#
# Build from the repository root:
#
# docker build -t warp-aio-pocketbase-s3 -f Docker-AIO/Dockerfile.PocketBase.s3 .
# docker run -p 8008:8008 -p 8009:8009 -p 8080:8080 -v warp-data:/data \
# -e WARP_SERVER_NAME=warp.example \
# -e WARP_PB_S3_ENDPOINT=https://s3.example.org -e WARP_PB_S3_BUCKET=warp \
# -e WARP_PB_S3_ACCESS_KEY=... -e WARP_PB_S3_SECRET=... \
# warp-aio-pocketbase-s3
#
# WARP_PB_S3_ENDPOINT, WARP_PB_S3_ACCESS_KEY and WARP_PB_S3_SECRET are
# required; the bucket (default warp) must exist, since nothing here creates
# it. Path-style addressing is on, which SeaweedFS and MinIO need; set
# WARP_PB_S3_FORCE_PATH_STYLE=false for AWS S3 proper. The container waits up
# to 30 seconds for the endpoint to answer before it starts the homeserver.
FROM node:22-alpine AS web
WORKDIR /src
RUN corepack enable
# Lockfile and manifests first, so the package store survives source changes.
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY apps/ui/package.json ./apps/ui/
COPY apps/admin/package.json ./apps/admin/
COPY apps/web/package.json ./apps/web/
RUN pnpm install --frozen-lockfile --filter @warp/admin... --filter @warp/web...
COPY apps/ui ./apps/ui
COPY apps/admin ./apps/admin
COPY apps/web ./apps/web
RUN pnpm --filter @warp/admin build && pnpm --filter @warp/web build
FROM golang:1.26-alpine AS build
ARG VERSION=0.0.0-dev
ARG COMMIT=unknown
ARG BUILD_DATE=unknown
ENV CGO_ENABLED=0
WORKDIR /src
# The homeserver. Dependencies first, so the module cache survives source
# changes.
COPY server/go.mod server/go.sum ./server/
RUN cd server && go mod download
COPY server ./server
RUN cd server && go build -trimpath \
-ldflags "-s -w \
-X github.com/dariuszjaniak/warp/server/internal/buildinfo.Version=${VERSION} \
-X github.com/dariuszjaniak/warp/server/internal/buildinfo.Commit=${COMMIT} \
-X github.com/dariuszjaniak/warp/server/internal/buildinfo.BuildDate=${BUILD_DATE}" \
-o /out/warp ./cmd/warp
# The admin panel and the web client, each with its frontend embedded.
COPY apps/admin/go.mod ./apps/admin/
COPY apps/admin/cmd ./apps/admin/cmd
COPY apps/admin/internal ./apps/admin/internal
COPY --from=web /src/apps/admin/internal/panel/build/dist ./apps/admin/internal/panel/build/dist
RUN cd apps/admin && GOWORK=off go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" \
-o /out/warp-admin ./cmd/warp-admin
COPY apps/web/go.mod ./apps/web/
COPY apps/web/cmd ./apps/web/cmd
COPY apps/web/host ./apps/web/host
COPY apps/web/client/client.go ./apps/web/client/
COPY --from=web /src/apps/web/client/build/dist ./apps/web/client/build/dist
RUN cd apps/web && GOWORK=off go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" \
-o /out/warp-web ./cmd/warp-web
FROM alpine:3.21
# tini is PID 1 so signals reach the entrypoint and zombies are reaped.
RUN apk add --no-cache ca-certificates tzdata curl tini && \
adduser -D -u 10001 -h /data warp
COPY --from=build /out/warp /out/warp-admin /out/warp-web /usr/local/bin/
COPY warp.yaml.example /etc/warp/warp.yaml.example
COPY --chmod=755 Docker-AIO/entrypoint.sh /usr/local/bin/warp-aio
# The database, signing key and anything stored before S3 was on live
# here; mount a volume on it.
WORKDIR /data
RUN chown warp:warp /data
USER warp
ENV WARP_LISTEN_ADDRESS=":8008" \
WARP_PRIVATE_KEY="/data/signing.key" \
WARP_DB_DRIVER="pocketbase" \
WARP_DB_CONNECTION_STRING="/data/pb_data" \
WARP_PB_S3_ENABLED="true" \
WARP_PB_S3_BUCKET="warp" \
WARP_PB_S3_REGION="us-east-1" \
WARP_PB_S3_FORCE_PATH_STYLE="true" \
WARP_LOG_FORMAT="json" \
WARP_ADMIN_LISTEN=":8009" \
WARP_ADMIN_HOMESERVER="http://127.0.0.1:8008" \
WARP_ADMIN_LOG_FORMAT="json" \
WARP_WEB_LISTEN=":8080" \
WARP_WEB_HOMESERVER="http://127.0.0.1:8008" \
WARP_WEB_LOG_FORMAT="json" \
WARP_AIO_ADMIN="true" \
WARP_AIO_WEB="true" \
WARP_AIO_EMBEDDED_POSTGRES="false"
EXPOSE 8008 8009 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl -fsS http://127.0.0.1:8008/healthz && \
{ [ "$WARP_AIO_ADMIN" != true ] || curl -fsS http://127.0.0.1:8009/healthz; } && \
{ [ "$WARP_AIO_WEB" != true ] || curl -fsS http://127.0.0.1:8080/healthz; } || exit 1
ENTRYPOINT ["/sbin/tini", "--", "warp-aio"]