Skip to content

Commit 1a2dbbf

Browse files
committed
feat: update Dockerfile for GitHub Packages authentication with NPM_TOKEN and enhance README instructions
1 parent 9fb4eb6 commit 1a2dbbf

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@ WORKDIR /app
1010

1111
# Copy package files
1212
COPY package*.json ./
13+
COPY .npmrc ./
1314
COPY prisma ./prisma/
1415

16+
# Configure npm authentication for private @auralyze/engine package from GitHub Packages
17+
# NPM_TOKEN must be set as a Railway environment variable
18+
ARG NPM_TOKEN
19+
RUN echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
20+
1521
# Install all dependencies (including dev dependencies for build)
22+
# This will authenticate with GitHub Packages using the token above
1623
RUN npm ci
1724

25+
# Remove npmrc files after install for security
26+
RUN rm -f ~/.npmrc .npmrc
27+
1828
# Generate Prisma Client (critical step!)
1929
RUN npx prisma generate
2030

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,14 @@ Response: `EngineState` from `@auralyze/engine` with all analysis results. Inclu
122122
Build the API service for Railway deployment:
123123

124124
```bash
125-
docker build -t auralyze-api .
125+
# Build with npm token for private @auralyze/engine package
126+
docker build --build-arg NPM_TOKEN=$NPM_TOKEN -t auralyze-api .
126127
docker run -p 8080:8080 --env-file .env auralyze-api
127128
```
128129

129130
The Dockerfile handles:
130131

132+
- **GitHub Packages Authentication**: Requires `NPM_TOKEN` build arg to install private `@auralyze/engine` package
131133
- **Prisma Client Generation**: Runs `npx prisma generate` during build
132134
- **Database Migrations**: Runs `npm run db:deploy` on container start
133135
- **TypeScript Compilation**: Builds to `dist/` directory
@@ -136,11 +138,12 @@ The Dockerfile handles:
136138
When deploying to Railway as a standalone repository:
137139

138140
1. Ensure `Dockerfile` exists in repo root (Railway auto-detects it)
139-
2. Add database reference: `DATABASE_URL=${{Postgres.DATABASE_URL}}`
140-
3. Configure service references for internal networking:
141+
2. **Set `NPM_TOKEN` environment variable** in Railway with your GitHub Personal Access Token (with `read:packages` scope)
142+
3. Add database reference: `DATABASE_URL=${{Postgres.DATABASE_URL}}`
143+
4. Configure service references for internal networking:
141144
- `METADATA_SERVICE_URL=https://metadata.railway.internal`
142145
- `ANALYSIS_SERVICE_URL=https://analysis.railway.internal`
143-
4. Generate and set API keys for service authentication
146+
5. Generate and set API keys for service authentication
144147

145148
The Dockerfile ensures Prisma Client is generated **before** runtime, preventing `@prisma/client did not initialize` errors.
146149
:::

0 commit comments

Comments
 (0)