From 1fc97c608c1d523f4d8d4d0a826c3fc337e67171 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Mon, 19 Feb 2024 19:09:06 +0100 Subject: [PATCH 1/3] fix: use relative backend path --- backend/Dockerfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 4f34db3..a8fa25b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -11,14 +11,10 @@ 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/ -# uncomment to copy the local pb_migrations dir into the image -COPY ./pb_migrations /pb/pb_migrations - -# uncomment to copy the local pb_hooks dir into the image +COPY ./backend/pb_migrations /pb/pb_migrations # COPY ./pb_hooks /pb/pb_hooks EXPOSE 8080 From 4962e961a98f48909854e6dcfce53b14e9a32f7e Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Mon, 19 Feb 2024 19:47:35 +0100 Subject: [PATCH 2/3] fix: use app user --- backend/Dockerfile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index a8fa25b..4b06177 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,23 +1,18 @@ FROM alpine:3.19.1 - -RUN addgroup -S nonroot \ - && adduser -S nonroot -G nonroot - -USER nonroot - ARG PB_VERSION=0.21.3 -RUN apk add --no-cache \ - unzip \ - ca-certificates +RUN addgroup -S app && adduser -S -G app app + +RUN apk add --no-cache unzip ca-certificates + +USER app 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 ./backend/pb_migrations /pb/pb_migrations -# COPY ./pb_hooks /pb/pb_hooks EXPOSE 8080 -# start PocketBase CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"] \ No newline at end of file From 6060f42db484b43847f207a9666047ee80332d5c Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Mon, 19 Feb 2024 19:49:36 +0100 Subject: [PATCH 3/3] fix: use mkdir before unzip --- backend/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 4b06177..ac0fdf6 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -7,12 +7,12 @@ RUN apk add --no-cache unzip ca-certificates USER app -ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip +RUN wget -O /tmp/pb.zip https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip -RUN unzip /tmp/pb.zip -d /pb/ +RUN mkdir /home/app/pb && unzip /tmp/pb.zip -d /home/app/pb/ -COPY ./backend/pb_migrations /pb/pb_migrations +COPY ./backend/pb_migrations /home/app/pb/pb_migrations EXPOSE 8080 -CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"] \ No newline at end of file +CMD ["/home/app/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]