Compare commits

..

6 Commits

Author SHA1 Message Date
69be5cb3e1 docker sucks x400 2026-02-17 19:25:46 +13:00
cd133d72ec docker dev genuinely sucks so fucking bad 2026-02-17 19:09:38 +13:00
04cd11b606 add drizzle for db lol 2026-02-17 18:57:26 +13:00
d1849774d9 add entrypoint for db migration push 2026-02-17 18:53:08 +13:00
6813f41d56 first attempt at a dockerfile and compose update 2026-02-17 18:43:28 +13:00
7ac31ccf2c Initial ui redo progress (#1)
Complete UI rewrite using shadcn-svelte for consistency and better design

Reviewed-on: #1
Co-authored-by: June <self@breadone.net>
Co-committed-by: June <self@breadone.net>
2026-02-17 18:29:59 +13:00
7 changed files with 104 additions and 10 deletions

1
.gitignore vendored
View File

@@ -17,6 +17,7 @@ Thumbs.db
.env.*
!.env.example
!.env.test
pgdata
# Vite
vite.config.js.timestamp-*

54
Dockerfile Normal file
View File

@@ -0,0 +1,54 @@
# Build stage
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Install pnpm
RUN npm install -g pnpm
# Install all dependencies (including dev)
RUN pnpm install --frozen-lockfile
# Copy source code
COPY . .
# Build the application
RUN pnpm run build
# Production stage
FROM node:22-alpine
WORKDIR /app
# Copy package files from builder
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Install pnpm
RUN npm install -g pnpm
# Install all dependencies (including dev for drizzle-kit)
RUN pnpm install --frozen-lockfile
# Copy built application from builder
COPY --from=builder /app/build ./build
# Copy drizzle config and schema for migrations
COPY drizzle.config.ts ./
COPY tsconfig.json ./
COPY src/lib/server/db ./src/lib/server/db
# Install netcat for database readiness check
RUN apk add --no-cache netcat-openbsd
# Copy entrypoint script
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Expose port (SvelteKit Node adapter default)
EXPOSE 5173
# Start the application
ENTRYPOINT ["/app/entrypoint.sh"]

View File

@@ -9,4 +9,22 @@ services:
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: memento
volumes:
- ~/tmp/pgdata:/var/lib/postgresql
# - ~/tmp/pgdata:/var/lib/postgresql
- ./pgdata:/var/lib/postgresql
app:
build: .
restart: always
ports:
- 5173:3000
depends_on:
- db
environment:
DATABASE_URL: postgresql://root:mysecretpassword@db:5432/memento
UPLOAD_DIR: /app/uploads
volumes:
# - .:/app
- ./uploads:/app/uploads
# - /app/node_modules

14
entrypoint.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
# Wait for PostgreSQL to be ready
while ! nc -z db 5432; do
sleep 1
done
# Run database migrations
echo "Pushing database schema..."
pnpm run db:push
# Start the application
echo "Starting application..."
node build

View File

@@ -57,17 +57,11 @@ export async function updateEntry(entry) {
}
export async function deleteEntry(entry) {
const res = await fetch(`/api/entry/delete`, {
await fetch(`/api/entry/delete`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ id: entry.id })
});
if (res.ok) {
entry = null;
} else {
alert('Failed to delete entry');
}
}

View File

@@ -16,10 +16,13 @@
let { children, data } = $props();
let dateValue = $derived(data.date);
let entries = $derived(data.entries);
let title = $state("Memento")
$effect(() => {
// Navigate when dateValue changes
goto(`/${dateValue}`);
title = `Memento: ${dateValue}`
});
$effect(() => {
@@ -28,7 +31,10 @@
});
</script>
<svelte:head><link rel="icon" href={favicon} /></svelte:head>
<svelte:head>
<title>{title}</title>
<link rel="icon" href={favicon} />
</svelte:head>
<ModeWatcher />
<div

View File

@@ -1,6 +1,13 @@
import adapter from '@sveltejs/adapter-node';
/** @type {import('@sveltejs/kit').Config} */
const config = { kit: { adapter: adapter() } };
const config = {
kit: {
adapter: adapter(),
csrf: {
checkOrigin: false
}
}
};
export default config;