Skip to content

Commit

Permalink
use pocketbase static file serving
Browse files Browse the repository at this point in the history
  • Loading branch information
Yhprum committed Nov 27, 2023
1 parent 342f944 commit 5e5e782
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:alpine as build

ADD . /app
WORKDIR /app

RUN npm install
RUN npm run build


FROM alpine:latest

ARG PB_VERSION=0.19.4

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 --from=build /app/build /pb_public

# 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 ./pb_hooks /pb/pb_hooks

EXPOSE 8090

# start PocketBase
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8090", "--dir=/pb_data", "--publicDir=/pb_public"]
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
runbacks:
container_name: runbacks
build: .
volumes:
- $VOLUME_PATH/Runbacks/pb:/pb_data
ports:
- 6533:8090
restart: unless-stopped
2 changes: 1 addition & 1 deletion src/lib/db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PocketBase from "pocketbase";

const pb = new PocketBase("https://runback-db.yhprum.com");
const pb = new PocketBase();

export default pb;
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { vitePreprocess } from "@sveltejs/kit/vite";
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter({ fallback: "404.html" }),
adapter: adapter({ fallback: "index.html" }),
}
};

Expand Down

0 comments on commit 5e5e782

Please sign in to comment.