Files
warehouse13/docs/DEPLOYMENT.md

114 lines
2.4 KiB
Markdown

# Deployment Options
This project supports two deployment strategies for the Angular frontend, depending on your environment's network access.
## Option 1: Standard Build (Internet Access Required)
Use the standard `Dockerfile.frontend` which builds the Angular app inside Docker.
**Requirements:**
- Internet access to npm registry
- Docker build environment
**Usage:**
```bash
./quickstart.sh
# or
docker-compose up -d --build
```
This uses `Dockerfile.frontend` which:
1. Installs npm dependencies in Docker
2. Builds Angular app in Docker
3. Serves with nginx
---
## Option 2: Pre-built Deployment (Air-Gapped/Restricted Environments)
Use `Dockerfile.frontend.prebuilt` for environments with restricted npm access or when esbuild platform binaries cannot be downloaded.
**Requirements:**
- Node.js 24+ installed locally
- npm installed locally
- No internet required during Docker build
**Usage:**
### Step 1: Build Angular app locally
```bash
cd frontend
npm install # Only needed once or when dependencies change
npm run build:prod
cd ..
```
### Step 2: Update docker-compose.yml
Edit `docker-compose.yml` and change the frontend dockerfile:
```yaml
frontend:
build:
context: .
dockerfile: Dockerfile.frontend.prebuilt # <-- Change this line
ports:
- "4200:80"
depends_on:
- api
```
### Step 3: Build and deploy
```bash
docker-compose up -d --build
```
This uses `Dockerfile.frontend.prebuilt` which:
1. Copies pre-built Angular files from `frontend/dist/`
2. Serves with nginx
3. No npm/node required in Docker
---
## Troubleshooting
### esbuild Platform Binary Issues
If you see errors like:
```
Could not resolve "@esbuild/darwin-arm64"
```
**Solution 1:** Use Option 2 (Pre-built) above
**Solution 2:** Add platform binaries to package.json (already included):
```json
"optionalDependencies": {
"@esbuild/darwin-arm64": "^0.25.4",
"@esbuild/darwin-x64": "^0.25.4",
"@esbuild/linux-arm64": "^0.25.4",
"@esbuild/linux-x64": "^0.25.4"
}
```
**Solution 3:** Use custom npm registry with cached esbuild binaries
### Custom NPM Registry
For both options, you can use a custom npm registry:
```bash
# Set in .env file
NPM_REGISTRY=http://your-npm-proxy:8081/repository/npm-proxy/
# Or inline
NPM_REGISTRY=http://your-proxy ./quickstart.sh
```
---
## Recommendation
- **Development/Cloud**: Use Option 1 (standard)
- **Air-gapped/Enterprise**: Use Option 2 (pre-built)
- **CI/CD**: Use Option 2 for faster, more reliable builds