File size: 1,143 Bytes
c85a338
 
 
 
1b7bb7b
c85a338
 
1b7bb7b
 
c85a338
1b7bb7b
 
c85a338
1b7bb7b
 
 
c85a338
1b7bb7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c85a338
7d438a7
c85a338
1b7bb7b
7d438a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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"]