diff --git a/CLAUDE.md b/CLAUDE.md index 8e3410f..e4f9f70 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 ` - Build Docker image + +**Deploying** (from repository root): +- `./deploy-standalone.sh ` - Deploy with docker-compose (standalone) +- `./deploy-swarm.sh ` - Deploy with Docker Swarm ## Architecture Overview diff --git a/README.md b/README.md index 6b67cd7..cf79d03 100644 --- a/README.md +++ b/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 diff --git a/.dockerignore b/web-app/.dockerignore similarity index 100% rename from .dockerignore rename to web-app/.dockerignore diff --git a/Dockerfile b/web-app/Dockerfile similarity index 72% rename from Dockerfile rename to web-app/Dockerfile index 0ca2f8d..a83f43e 100644 --- a/Dockerfile +++ b/web-app/Dockerfile @@ -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 diff --git a/build.sh b/web-app/build.sh similarity index 100% rename from build.sh rename to web-app/build.sh