33
Dockerfile
Normal file
33
Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
||||
FROM oven/bun AS base
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
FROM base AS install
|
||||
RUN mkdir -p /temp/dev
|
||||
COPY package.json bun.lock /temp/dev/
|
||||
RUN cd /temp/dev && bun install --frozen-lockfile
|
||||
|
||||
RUN mkdir -p /temp/prod
|
||||
COPY package.json bun.lock /temp/prod/
|
||||
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
||||
|
||||
# Build
|
||||
FROM base AS build
|
||||
COPY --from=install /temp/dev/node_modules node_modules
|
||||
COPY . .
|
||||
ENV NODE_ENV=production
|
||||
RUN bun run build
|
||||
|
||||
# Runtime
|
||||
FROM base AS runtime
|
||||
COPY --from=install /temp/prod/node_modules node_modules
|
||||
COPY --from=build /app/build build
|
||||
COPY --from=build /app/package.json .
|
||||
|
||||
USER bun
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV HOST=0.0.0.0
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["bun", "build/index.js"]
|
||||
44
docker-compose.yml
Normal file
44
docker-compose.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
# docker-compose.yml
|
||||
# Production deployment: SvelteKit app + PostgreSQL
|
||||
# Usage: docker compose up -d
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:17
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: vash
|
||||
POSTGRES_USER: vash
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme_in_production}
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "127.0.0.1:5432:5432" # Only accessible from host
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U vash -d vash"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
app:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "127.0.0.1:3000:3000" # Only accessible from host (nginx proxies)
|
||||
environment:
|
||||
DATABASE_URL: postgresql://vash:${DB_PASSWORD:-changeme_in_production}@db:5432/vash
|
||||
ORIGIN: ${ORIGIN:-https://vash.yourdomain.com}
|
||||
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET}
|
||||
OSU_CLIENT_ID: ${OSU_CLIENT_ID}
|
||||
OSU_CLIENT_SECRET: ${OSU_CLIENT_SECRET}
|
||||
OSU_IRC_USERNAME: ${OSU_IRC_USERNAME}
|
||||
OSU_IRC_PASSWORD: ${OSU_IRC_PASSWORD}
|
||||
NODE_ENV: production
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
Reference in New Issue
Block a user