Skip to content

Commit cdfdf71

Browse files
committed
refactor: use single source sdk.tgz, robust makefile, and fixed tests
1 parent 8330779 commit cdfdf71

52 files changed

Lines changed: 139 additions & 64 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 73 additions & 0 deletions

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
node_modules
1+
**/node_modules
22
packages
33
dist
44
.git

Makefile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ docker-build: docker-build-runtime
3333
@for fn in functions/*; do \
3434
if [ -f "$$fn/Dockerfile" ]; then \
3535
echo "Building $$fn..."; \
36-
docker build -t "$(REGISTRY)/$$(basename $$fn):latest" "$$fn"; \
36+
docker build -t "$(REGISTRY)/$$(basename $$fn):latest" -f "$$fn/Dockerfile" .; \
3737
fi \
3838
done
3939

4040
docker-build-simple-email:
41-
docker build -t $(REGISTRY)/simple-email:latest functions/simple-email
41+
docker build -t $(REGISTRY)/simple-email:latest -f functions/simple-email/Dockerfile .
4242

4343
docker-build-send-email-link:
44-
docker build -t $(REGISTRY)/send-email-link:latest functions/send-email-link
44+
docker build -t $(REGISTRY)/send-email-link:latest -f functions/send-email-link/Dockerfile .
4545

4646
docker-push:
4747
@echo "Pushing Docker images to $(REGISTRY)..."
@@ -58,9 +58,20 @@ docker-push-simple-email:
5858
docker-push-send-email-link:
5959
docker push $(REGISTRY)/send-email-link:latest
6060

61+
# Bulk Kind Load
62+
kind-load-all:
63+
@echo "Loading all function images into Kind..."
64+
@for fn in functions/*; do \
65+
if [ -f "$$fn/Dockerfile" ]; then \
66+
echo "Loading $$fn..."; \
67+
$(KIND_BIN) load docker-image "$(REGISTRY)/$$(basename $$fn):latest" --name $(KIND_CLUSTER_NAME); \
68+
fi \
69+
done
70+
6171
# Kubernetes Test Runner
6272
# Run All Tests inside K8s (Centralized Runner)
63-
test-k8s-all:
73+
# Depends on building and loading ALL images to ensure environment is complete.
74+
test-k8s-all: docker-build kind-load-all
6475
@echo "Running all K8s tests via centralized KubernetesJS runner..."
6576
pnpm exec ts-node scripts/test-runner.ts
6677

functions/_runtimes/node/Dockerfile.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ COPY . /app
77
WORKDIR /app
88

99
# Ensure clean slate
10-
RUN rm -rf node_modules
10+
RUN rm -rf node_modules pnpm-lock.yaml
1111

1212
# 3. Configure PNPM Home
1313
ENV PNPM_HOME="/root/.local/share/pnpm"

functions/_runtimes/sdk.tgz

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../sdk.tgz

functions/create-db/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ FROM node:22-alpine
22

33
WORKDIR /usr/src/app
44

5-
COPY package.json ./
5+
COPY functions/create-db/package.json ./
66
COPY sdk.tgz /usr/sdk.tgz
77
RUN npm install -g pnpm@10.12.2 && pnpm install --prod
88

9-
COPY dist ./dist
9+
COPY functions/create-db/dist ./dist
1010

1111
ENV NODE_ENV=production
1212
ENV PORT=8080

functions/create-db/__tests__/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('Create DB Function (Integration)', () => {
6666
restartPolicy: 'Never',
6767
containers: [{
6868
name: 'create-db',
69-
image: 'constructive/function-test-runner:v8',
69+
image: 'constructive/function-test-runner:v9',
7070
imagePullPolicy: "IfNotPresent",
7171
command: ["npx", "ts-node", "functions/_runtimes/node/runner.js", "functions/create-db/src/index.ts"],
7272
env: [

functions/create-db/sdk.tgz

-537 KB
Binary file not shown.

functions/create-db/sdk.tgz

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../sdk.tgz

functions/crypto-login/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ FROM node:22-alpine
22

33
WORKDIR /usr/src/app
44

5-
COPY package.json ./
5+
COPY functions/crypto-login/package.json ./
66
COPY sdk.tgz /usr/sdk.tgz
77
RUN npm install -g pnpm@10.12.2 && pnpm install --prod
88

9-
COPY dist ./dist
9+
COPY functions/crypto-login/dist ./dist
1010

1111
ENV NODE_ENV=production
1212
ENV PORT=8080

0 commit comments

Comments
 (0)