Skip to content

Instantly share code, notes, and snippets.

@herveGuigoz
Last active April 21, 2025 08:54
Show Gist options
  • Save herveGuigoz/97f324882fdb4365db93e3dafc5c7e71 to your computer and use it in GitHub Desktop.
Save herveGuigoz/97f324882fdb4365db93e3dafc5c7e71 to your computer and use it in GitHub Desktop.
Pocketbase Docker
services:
pocketbase:
build:
context: .
container_name: pocketbase
restart: unless-stopped
networks:
- lan
volumes:
- ./etc/pb_data:/pb/pb_data
- ./etc/pb_migrations:/pb/pb_migrations
- ./etc/pb_hooks:/pb/pb_hooks
labels:
traefik.enable: true
traefik.http.services.pocketbase.loadbalancer.server.port: 8080
traefik.http.routers.pocketbase-https.rule: Host(`${SERVER_NAME}`)
traefik.http.routers.pocketbase-https.entrypoints: https
traefik.http.routers.pocketbase-https.service: pocketbase
networks:
lan:
external: true
FROM alpine:latest
ARG PB_VERSION=0.22.21
RUN apk add --no-cache \
unzip \
ca-certificates
# download and unzip PocketBase
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
RUN unzip /tmp/pb.zip -d /pb/
COPY ./etc/pb_data /pb/pb_data
COPY ./etc/pb_migrations /pb/pb_migrations
COPY ./etc/pb_hooks /pb/pb_hooks
EXPOSE 8080
# start PocketBase
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment