refactor: move Docker build files to web-app directory
Moved Dockerfile, build.sh, and .dockerignore to web-app/ for better project encapsulation. Each project now contains its own build configuration. ## Changes - Moved Dockerfile to web-app/ and simplified paths - Moved build.sh to web-app/ - Moved .dockerignore to web-app/ - Updated Dockerfile to work from web-app/ context (no workspace references) - Updated documentation for new build workflow ## Build Workflow - Build: Run from web-app/ directory (`cd web-app && ./build.sh 2.20.0`) - Deploy: Run from repository root (`./deploy-standalone.sh 2.20.0`) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,9 +30,12 @@ All commands should be run from within the respective project directory.
|
||||
|
||||
## Deployment Commands
|
||||
|
||||
- `./build.sh` - Build Docker image for deployment
|
||||
- `./deploy.sh` - Deploy Docker service to production
|
||||
- `./debug-deploy.sh` - Deploy with debug configuration
|
||||
**Building Docker Image** (from web-app directory):
|
||||
- `cd web-app && ./build.sh <version>` - Build Docker image
|
||||
|
||||
**Deploying** (from repository root):
|
||||
- `./deploy-standalone.sh <version>` - Deploy with docker-compose (standalone)
|
||||
- `./deploy-swarm.sh <version>` - Deploy with Docker Swarm
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
|
||||
27
README.md
27
README.md
@@ -112,21 +112,30 @@ All backups are stored in `./mongo-backup/`:
|
||||
This directory is excluded from git via `.gitignore`.
|
||||
|
||||
# Deploying
|
||||
The deployment is done via Docker:
|
||||
* build docker image
|
||||
* deploy Docker service
|
||||
|
||||
## Building Docker image
|
||||
Run the following command:
|
||||
The deployment is done via Docker.
|
||||
|
||||
## Building Docker Image
|
||||
|
||||
From the `web-app/` directory:
|
||||
|
||||
```bash
|
||||
build.sh
|
||||
cd web-app
|
||||
./build.sh 2.20.0
|
||||
```
|
||||
|
||||
The image will be stored in the local Docker instance.
|
||||
|
||||
## Deploying Docker service
|
||||
Run the following command:
|
||||
## Deploying Docker Service
|
||||
|
||||
From the repository root:
|
||||
|
||||
```bash
|
||||
deploy.sh
|
||||
# Standalone deployment
|
||||
./deploy-standalone.sh 2.20.0
|
||||
|
||||
# Or Swarm deployment
|
||||
./deploy-swarm.sh 2.20.0
|
||||
```
|
||||
|
||||
# Implementation details
|
||||
|
||||
@@ -12,20 +12,17 @@ RUN apk add --no-cache libc6-compat
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy monorepo root package files
|
||||
# Copy package files
|
||||
COPY ./package.json ./package-lock.json ./
|
||||
|
||||
# Copy workspace package files
|
||||
COPY ./web-app/package.json ./web-app/package-lock.json ./web-app/
|
||||
|
||||
# Install dependencies (workspaces)
|
||||
# Install dependencies
|
||||
RUN npm i && npm cache clean --force
|
||||
|
||||
# Copy web-app source code
|
||||
COPY ./web-app ./web-app
|
||||
# Copy application source code
|
||||
COPY . .
|
||||
|
||||
# Build web-app workspace
|
||||
RUN npm run build --workspace=web-app
|
||||
# Build application
|
||||
RUN npm run build
|
||||
|
||||
#-----------------------------------------
|
||||
# STAGE 3: Run the Next.js server
|
||||
@@ -37,14 +34,14 @@ WORKDIR /app
|
||||
# making sure the production server does not use mock auth
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=builder /app/web-app/public/* /app/public/
|
||||
COPY --from=builder /app/public/* /app/public/
|
||||
# this file is required for the pdfjs-dist package
|
||||
COPY --from=builder /app/node_modules/pdfjs-dist/build/pdf.worker.min.mjs /app/public/pdf.worker.min.mjs
|
||||
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
COPY --from=builder --chown=nonroot:nonroot /app/web-app/.next/standalone ./
|
||||
COPY --from=builder --chown=nonroot:nonroot /app/web-app/.next/static ./.next/static
|
||||
COPY --from=builder --chown=nonroot:nonroot /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nonroot:nonroot /app/.next/static ./.next/static
|
||||
|
||||
USER nonroot
|
||||
|
||||
Reference in New Issue
Block a user