bump to v 0.1.1, change default port to 3003, fix Dockerfile to build & run separately

This commit is contained in:
2026-06-28 17:29:21 -06:00
parent 85301135c7
commit a99117dc98
6 changed files with 42 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
# HTTP port (default: 3000) # HTTP port (default: 3003)
PORT=3000 PORT=3003
# Firebase Admin: inline service account JSON (one line). # Firebase Admin: inline service account JSON (one line).
# If unset, uses Application Default Credentials (e.g. GOOGLE_APPLICATION_CREDENTIALS). # If unset, uses Application Default Credentials (e.g. GOOGLE_APPLICATION_CREDENTIALS).

View File

@@ -1,17 +1,31 @@
FROM node:22-alpine # ---- build stage: install everything, type-check + compile to JS ----
FROM node:22-alpine AS build
RUN corepack enable && corepack prepare pnpm@11.4.0 --activate RUN corepack enable && corepack prepare pnpm@11.4.0 --activate
WORKDIR /app WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm install --prod RUN pnpm install --frozen-lockfile
COPY src ./src
COPY tsconfig.json ./ COPY tsconfig.json ./
COPY src ./src
RUN pnpm build
# ---- runtime stage: prod deps + compiled JS only, no tsx/esbuild ----
FROM node:22-alpine AS runtime
RUN corepack enable && corepack prepare pnpm@11.4.0 --activate
WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm install --prod --frozen-lockfile
COPY --from=build /app/dist ./dist
ENV NODE_ENV=production ENV NODE_ENV=production
ENV PORT=3000 ENV PORT=3003
EXPOSE 3000 EXPOSE 3003
CMD ["node", "--import", "tsx/esm", "src/index.ts"] CMD ["node", "dist/index.js"]

View File

@@ -14,7 +14,7 @@ pnpm install
pnpm run dev pnpm run dev
``` ```
The server starts on `http://localhost:3000` (or the port in `PORT`). Hot-reloads on file changes. The server starts on `http://localhost:3003` (or the port in `PORT`). Hot-reloads on file changes.
Set `NODE_ENV=test-local` in `.env` to bypass JWT expiry verification during local development. Set `NODE_ENV=test-local` in `.env` to bypass JWT expiry verification during local development.
@@ -30,8 +30,8 @@ pnpm start
Or with Docker: Or with Docker:
```bash ```bash
docker build -t notification-wakeup-service . docker build --no-cache -t notify-wakeup-api:amd-$NOTIFY_WAKEUP_API_VERSION --platform linux/amd64 .
docker run -e FIREBASE_SERVICE_ACCOUNT_JSON='...' -p 3000:3000 notification-wakeup-service docker run --env-file notify-wakeup-api.env -p 3003:3003 notify-wakeup-api
``` ```
Required environment variables: Required environment variables:
@@ -39,5 +39,5 @@ Required environment variables:
| Variable | Description | | Variable | Description |
|---|---| |---|---|
| `FIREBASE_SERVICE_ACCOUNT_JSON` | Inline service account JSON (one line). If unset, falls back to Application Default Credentials. | | `FIREBASE_SERVICE_ACCOUNT_JSON` | Inline service account JSON (one line). If unset, falls back to Application Default Credentials. |
| `PORT` | HTTP port (default: `3000`). | | `PORT` | HTTP port (default: `3003`). |
| `FCM_TOKEN_DATA_DIR` | Directory for persisting registered FCM tokens (default: `./data`). | | `FCM_TOKEN_DATA_DIR` | Directory for persisting registered FCM tokens (default: `./data`). |

View File

@@ -1,6 +1,6 @@
{ {
"name": "notification-wakeup-service", "name": "notification-wakeup-service",
"version": "0.1.0", "version": "0.1.1",
"private": true, "private": true,
"type": "module", "type": "module",
"packageManager": "pnpm@11.4.0", "packageManager": "pnpm@11.4.0",
@@ -18,14 +18,13 @@
"did-jwt": "^7.4.7", "did-jwt": "^7.4.7",
"did-resolver": "^4.1.0", "did-resolver": "^4.1.0",
"express": "^5.2.1", "express": "^5.2.1",
"firebase-admin": "^13.10.0", "firebase-admin": "^13.10.0"
"tsx": "^4.22.3"
}, },
"devDependencies": { "devDependencies": {
"@types/express": "^5.0.6", "@types/express": "^5.0.6",
"@types/node": "^22.19.19", "@types/node": "^22.19.19",
"@types/cors": "^2.8.19", "@types/cors": "^2.8.19",
"tsx": "^4.19.2", "tsx": "^4.22.3",
"typescript": "^5.9.3" "typescript": "^5.9.3"
} }
} }

15
pnpm-lock.yaml generated
View File

@@ -26,15 +26,15 @@ importers:
did-resolver: did-resolver:
specifier: ^4.1.0 specifier: ^4.1.0
version: 4.1.0 version: 4.1.0
dotenv:
specifier: ^16.6.1
version: 16.6.1
express: express:
specifier: ^5.2.1 specifier: ^5.2.1
version: 5.2.1 version: 5.2.1
firebase-admin: firebase-admin:
specifier: ^13.10.0 specifier: ^13.10.0
version: 13.10.0 version: 13.10.0
tsx:
specifier: ^4.22.3
version: 4.22.3
devDependencies: devDependencies:
'@types/cors': '@types/cors':
specifier: ^2.8.19 specifier: ^2.8.19
@@ -45,6 +45,9 @@ importers:
'@types/node': '@types/node':
specifier: ^22.19.19 specifier: ^22.19.19
version: 22.19.19 version: 22.19.19
tsx:
specifier: ^4.22.3
version: 4.22.3
typescript: typescript:
specifier: ^5.9.3 specifier: ^5.9.3
version: 5.9.3 version: 5.9.3
@@ -574,6 +577,10 @@ packages:
did-resolver@4.1.0: did-resolver@4.1.0:
resolution: {integrity: sha512-S6fWHvCXkZg2IhS4RcVHxwuyVejPR7c+a4Go0xbQ9ps5kILa8viiYQgrM4gfTyeTjJ0ekgJH9gk/BawTpmkbZA==} resolution: {integrity: sha512-S6fWHvCXkZg2IhS4RcVHxwuyVejPR7c+a4Go0xbQ9ps5kILa8viiYQgrM4gfTyeTjJ0ekgJH9gk/BawTpmkbZA==}
dotenv@16.6.1:
resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==}
engines: {node: '>=12'}
dunder-proto@1.0.1: dunder-proto@1.0.1:
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@@ -1711,6 +1718,8 @@ snapshots:
did-resolver@4.1.0: {} did-resolver@4.1.0: {}
dotenv@16.6.1: {}
dunder-proto@1.0.1: dunder-proto@1.0.1:
dependencies: dependencies:
call-bind-apply-helpers: 1.0.2 call-bind-apply-helpers: 1.0.2

View File

@@ -7,7 +7,7 @@ import { notificationsRouter } from "./routes/notifications.js";
import { startScheduler } from "./scheduler.js"; import { startScheduler } from "./scheduler.js";
const app = express(); const app = express();
const port = Number(process.env.PORT) || 3000; const port = Number(process.env.PORT) || 3003;
app.use( app.use(
cors({ cors({