-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0ba1da
commit 667ef02
Showing
4 changed files
with
52 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,32 @@ | ||
# Use Node.js alpine as the base image | ||
FROM node:18-alpine | ||
FROM alpine:latest | ||
|
||
ARG PB_VERSION=0.22.21 | ||
ARG [email protected] | ||
ARG POCKETBASE_ADMIN_PASSWORD=admin123 | ||
|
||
RUN apk add --no-cache \ | ||
unzip \ | ||
ca-certificates | ||
ca-certificates \ | ||
curl | ||
|
||
# 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 ./pb_hooks /pb/pb_hooks | ||
|
||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install SvelteKit dependencies | ||
RUN npm install | ||
# create PocketBase data directory | ||
RUN mkdir -p /pb/pb_data | ||
COPY start.sh /pb/start.sh | ||
|
||
# Copy the rest of the SvelteKit app's source code | ||
COPY . . | ||
# start PocketBase in a background process to set up the database | ||
RUN chmod +x /pb/start.sh | ||
|
||
# Expose the PocketBase HTTP port | ||
EXPOSE 8090 3000 | ||
|
||
# Copy the start.sh script into the container | ||
COPY start.sh /start.sh | ||
|
||
# Make the script executable | ||
RUN chmod +x /start.sh | ||
|
||
# Use the script to start PocketBase and create the admin user | ||
RUN ["/bin/sh", "/start.sh"] | ||
|
||
# Install supervisor | ||
RUN apk add --no-cache supervisor | ||
# uncomment to copy the local pb_migrations dir into the image | ||
# COPY ./pb_migrations /pb/pb_migrations | ||
|
||
# Copy supervisor configuration | ||
COPY supervisord.conf /etc/supervisord.conf | ||
# uncomment to copy the local pb_hooks dir into the image | ||
# COPY ./pb_hooks /pb/pb_hooks | ||
|
||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] | ||
EXPOSE 8080 | ||
|
||
# CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8090", "--dev", "&&", "echo", "hello"] | ||
# CMD echo "hello" & \ | ||
# /pb/pocketbase serve --http=0.0.0.0:8090 --dev & \ | ||
# /usr/local/bin/node build & | ||
# start PocketBase | ||
CMD ["/pb/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
sveltekit-pocketbase: | ||
image: local-sveltekit-pocketbase:test | ||
ports: | ||
- "8090:8090" # SvelteKit app | ||
- "3000:3000" | ||
env_file: | ||
- .env | ||
- "8080:8080" | ||
environment: | ||
- POCKETBASE_URL=http://localhost:8080 | ||
- API_KEY=compose-runtime-key | ||
- [email protected] | ||
- POCKETBASE_ADMIN_PASSWORD=123 | ||
- TITLE=Compose Runtime App | ||
volumes: | ||
- ./pb_data:/app/pb_data |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
import { json } from '@sveltejs/kit'; | ||
import type { RequestHandler } from './$types'; | ||
import { superValidate } from 'sveltekit-superforms'; | ||
import { formSchema } from '$lib/components/schema'; | ||
import { zod } from 'sveltekit-superforms/adapters'; | ||
import { TITLE } from '$env/static/private'; | ||
import { json } from "@sveltejs/kit"; | ||
import type { RequestHandler } from "./$types"; | ||
import { superValidate } from "sveltekit-superforms"; | ||
import { formSchema } from "$lib/components/schema"; | ||
import { zod } from "sveltekit-superforms/adapters"; | ||
import { | ||
TITLE, | ||
POCKETBASE_ADMIN_EMAIL, | ||
POCKETBASE_ADMIN_PASSWORD, | ||
} from "$env/static/private"; | ||
|
||
export async function load({ fetch, params }) { | ||
const ftree = await fetch('/api/ls'); | ||
const tagresp = await fetch('/api/tags'); | ||
const tags = await tagresp.json(); | ||
const filetree = await ftree.json(); | ||
const siteTitle = TITLE; | ||
const ftree = await fetch("/api/ls"); | ||
const tagresp = await fetch("/api/tags"); | ||
const tags = await tagresp.json(); | ||
const filetree = await ftree.json(); | ||
const siteTitle = TITLE; | ||
|
||
return { filetree, siteTitle, tags }; | ||
console.log( | ||
"logged in with: ", | ||
POCKETBASE_ADMIN_EMAIL, | ||
POCKETBASE_ADMIN_PASSWORD, | ||
); | ||
|
||
return { filetree, siteTitle, tags }; | ||
} |