first attempt at a dockerfile and compose update

This commit is contained in:
2026-02-17 18:43:28 +13:00
parent 7ac31ccf2c
commit 6813f41d56
2 changed files with 62 additions and 3 deletions

42
Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
# 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 dependencies
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 only production dependencies
RUN pnpm install --frozen-lockfile --prod
# Copy built application from builder
COPY --from=builder /app/build ./build
# Expose port (SvelteKit Node adapter default)
EXPOSE 5173
# Start the application
CMD ["node", "build"]

View File

@@ -2,11 +2,28 @@ services:
db: db:
image: postgres image: postgres
restart: always restart: always
ports: # ports:
- 5432:5432 # - 5432:5432
environment: environment:
POSTGRES_USER: root POSTGRES_USER: root
POSTGRES_PASSWORD: mysecretpassword POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: memento POSTGRES_DB: memento
volumes: volumes:
- ~/tmp/pgdata:/var/lib/postgresql - ./pgdata:/var/lib/postgresql
app:
build: .
restart: always
ports:
- 5173:5173
depends_on:
- db
environment:
DATABASE_URL: postgresql://root:mysecretpassword@db:5432/memento
UPLOAD_DIR: /app/uploads
volumes:
# - .:/app
- ./uploads:/app/uploads
# - /app/node_modules