pocket / Dockerfile
jiseki's picture
Update Dockerfile
7d438a7 verified
FROM alpine:latest
ARG PB_VERSION=0.25.8
# Install required dependencies
RUN apk add --no-cache \
unzip \
ca-certificates \
shadow # Needed for useradd
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Create necessary directories with correct permissions
RUN mkdir -p $HOME/app /pb && chown -R user:user $HOME/app /pb
# Switch to the "user" user
USER user
# Download and unzip PocketBase, ensuring correct ownership
ADD --chown=user 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/ && rm /tmp/pb.zip
# Uncomment to copy the local pb_migrations dir into the image
# COPY --chown=user ./pb_migrations /pb/pb_migrations
# Uncomment to copy the local pb_hooks dir into the image
# COPY --chown=user ./pb_hooks /pb/pb_hooks
EXPOSE 7860
# Start PocketBase
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:7860"]