Skip to content

Commit

Permalink
chore: docs docker setup copying dist folder
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbrusegard committed Oct 5, 2024
1 parent 9bd1146 commit 1228612
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
cd /data/WebGL-Fluid-Enhanced
git pull
bun install
cd docs && bun install
bun run build
cd docs
docker compose down
Expand Down
18 changes: 10 additions & 8 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@ FROM imbios/bun-node:22-slim AS base
# Install dependencies only when needed
FROM base AS deps

WORKDIR /app
WORKDIR /app/docs

# Install dependencies
COPY package.json bun.lockb ./
COPY docs/package.json docs/bun.lockb ./
RUN bun install --frozen-lockfile

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
WORKDIR /app/docs
COPY --from=deps /app/docs/node_modules ./node_modules
COPY docs .

# Copy dist folder
COPY dist ../dist

# Disable telemetry during the build
ENV NEXT_TELEMETRY_DISABLED=true

# Build the application
RUN bunx next build


# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
WORKDIR /app/docs

ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=true
Expand All @@ -36,7 +38,7 @@ RUN addgroup --system --gid 1002 nodejs && \
RUN mkdir .next && chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/docs/.next/standalone ./

USER nextjs

Expand Down
4 changes: 3 additions & 1 deletion docs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
docs:
build: .
build:
context: ..
dockerfile: ./docs/Dockerfile
restart: unless-stopped
networks:
- nginx_default
Expand Down

0 comments on commit 1228612

Please sign in to comment.