feat(Docker): add Dockerfile and docker-compose for app and services setup
This commit is contained in:
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
||||
FROM oven/bun:alpine AS base
|
||||
|
||||
# Stage 1: Install dependencies
|
||||
FROM base AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json bun.lockb ./
|
||||
RUN bun install
|
||||
|
||||
# Stage 2: Build the application
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
# Stage 3: Production server
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["bun", "run", "server.js"]
|
||||
65
docker-compose.yml
Normal file
65
docker-compose.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
services:
|
||||
pocketbase:
|
||||
image: ghcr.io/muchobien/pocketbase:latest
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --encryptionEnv #optional
|
||||
- ENCRYPTION #optional
|
||||
environment:
|
||||
ENCRYPTION: ${ENCRYPTION_SECRET}
|
||||
ports:
|
||||
- "3002:8090"
|
||||
volumes:
|
||||
- ./data/pb/data:/pb_data
|
||||
- ./data/pb/public:/pb_public #optional
|
||||
- ./data/pb/hooks:/pb_hooks #optional
|
||||
healthcheck: #optional (recommended) since v0.10.0
|
||||
test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
umami:
|
||||
image: ghcr.io/umami-software/umami:postgresql-latest
|
||||
ports:
|
||||
- "3001:3000"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://umami:umami@umami-db:5432/umami
|
||||
DATABASE_TYPE: postgresql
|
||||
APP_SECRET: ${APP_SECRET}
|
||||
depends_on:
|
||||
umami-db:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
app:
|
||||
build: .
|
||||
ports:
|
||||
- '3000:3000'
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- NEXT_PUBLIC_UMAMI_URL=${NEXT_PUBLIC_UMAMI_URL}
|
||||
- NEXT_PUBLIC_UMAMI_TOKEN=${NEXT_PUBLIC_UMAMI_TOKEN}
|
||||
- NEXT_PUBLIC_POCKETBASE_URL=${NEXT_PUBLIC_POCKETBASE_URL}
|
||||
restart: unless-stopped
|
||||
|
||||
umami-db:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
POSTGRES_DB: umami
|
||||
POSTGRES_USER: umami
|
||||
POSTGRES_PASSWORD: umami
|
||||
volumes:
|
||||
- ./data/umami/data:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
NEXT_PUBLIC_POCKETBASE_URL=https://pb-phs.fly.dev
|
||||
NEXT_PUBLIC_ANALYTICS_URL=
|
||||
NEXT_PUBLIC_ANALYTICS_TOKEN=
|
||||
NEXT_PUBLIC_POCKETBASE_URL=https://pocketbase.proxmoxve-scripts.com
|
||||
NEXT_PUBLIC_ANALYTICS_URL=https://analytics.proxmoxve-scripts.com
|
||||
NEXT_PUBLIC_ANALYTICS_TOKEN=b60d130323-1a11-4244-a1010-81d263c5c49a7
|
||||
APP_SECRET=faeziwezrdgsjibjahyusndwwpiwykgfhdjhysaidmtwywivmh
|
||||
ENCRYPTION_SECRET=idtrkpcthrnirnqxkafbivyditqnxsnymrfpeqqsookzjyuvmz
|
||||
NODE_ENV=production
|
||||
|
||||
@@ -14,6 +14,8 @@ const nextConfig = {
|
||||
],
|
||||
},
|
||||
|
||||
output: "standalone",
|
||||
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user