-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure docker images can build in pipeline #1208
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,12 @@ ENV DOCKER_BUILD=1 | |
|
||
RUN npm install -g [email protected] [email protected] --ignore-scripts | ||
COPY --from=builder /app/out/json . | ||
RUN pnpm install --ignore-scripts | ||
COPY --from=builder /app/out/full/packages/db/prisma/schema.prisma packages/db/prisma/schema.prisma | ||
|
||
# Must enable scripts here for Prisma codegen to build | ||
RUN apk update && apk add --no-cache python3 gcc g++ make | ||
RUN pnpm install | ||
|
||
COPY --from=builder /app/out/full . | ||
RUN turbo run build --filter @dotkomonline/dashboard | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,14 @@ ENV DOCKER_BUILD=1 | |
|
||
RUN npm install -g [email protected] [email protected] --ignore-scripts | ||
COPY --from=builder /app/out/json . | ||
RUN pnpm install --ignore-scripts | ||
COPY --from=builder /app/out/full . | ||
RUN turbo run build --filter @dotkomonline/rpc | ||
COPY --from=builder /app/out/full/packages/db/prisma/schema.prisma packages/db/prisma/schema.prisma | ||
|
||
# Must enable scripts here for Prisma codegen to build | ||
RUN apk update && apk add --no-cache python3 gcc g++ make | ||
RUN pnpm install | ||
|
||
# Install for production | ||
RUN pnpm install --production | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
@@ -34,7 +39,7 @@ RUN addgroup --system --gid 1001 nodejs | |
RUN adduser --system --uid 1001 rpc | ||
USER rpc | ||
|
||
COPY --from=installer --chown=nodejs:rpc --chmod=755 /app/apps/rpc/dist/index.js ./ | ||
COPY --from=installer --chown=nodejs:rpc --chmod=755 /app/apps/rpc/package.json ./ | ||
COPY --from=installer --chown=rpc:nodejs --chmod=755 /app . | ||
COPY --from=builder --chown=rpc:nodejs --chmod=755 /app/out/full . | ||
|
||
CMD node index.js | ||
CMD node --loader ./apps/rpc/runtime.mjs --experimental-strip-types ./apps/rpc/src/index.ts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import path from "node:path" | ||
import { URL } from "node:url" | ||
|
||
export async function resolve(specifier, context, nextResolve) { | ||
// Only handle relative or absolute paths without extensions | ||
if ( | ||
(specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/")) && | ||
!path.extname(specifier) | ||
) { | ||
// Try with .ts extension first | ||
const tsFile = `${specifier}.ts` | ||
const resolvedTsPath = new URL(tsFile, context.parentURL).href | ||
return { | ||
url: resolvedTsPath, | ||
shortCircuit: true, | ||
} | ||
} | ||
|
||
// Let Node.js handle it if no match | ||
return nextResolve(specifier) | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,7 @@ | |
"name": "monorepo", | ||
"version": "1.0.0", | ||
"description": "Monoweb is the next-generation web application for Online. This is the monorepo source.", | ||
"keywords": [ | ||
"online", | ||
"ntnu", | ||
"student-association" | ||
], | ||
"keywords": ["online", "ntnu", "student-association"], | ||
"homepage": "https://online.ntnu.no", | ||
"author": "Dotkom <[email protected]> (https://online.ntnu.no)", | ||
"bugs": { | ||
|
@@ -37,13 +33,11 @@ | |
"type-check": "turbo run type-check", | ||
"clean": "turbo run clean", | ||
"docker:login": "aws ecr get-login-password --region eu-north-1 | docker login --username AWS --password-stdin 891459268445.dkr.ecr.eu-north-1.amazonaws.com", | ||
"docker:build": "turbo run docker:build", | ||
"docker:login:public": "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws", | ||
"shell": "pnpm --filter=@dotkomonline/shell start" | ||
}, | ||
"workspaces": [ | ||
"packages/*", | ||
"apps/*" | ||
], | ||
"workspaces": ["packages/*", "apps/*"], | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
"node": ">=20.12.2", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,21 @@ | |
"name": "@dotkomonline/db", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"main": "./src/index.ts", | ||
"types": "./src/index.ts", | ||
"private": true, | ||
"exports": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed, so that Same goes for the test harness |
||
".": { | ||
"import": "./src/index.ts", | ||
"types": "./src/index.ts" | ||
}, | ||
"./schemas": { | ||
"import": "./src/schemas.ts", | ||
"types": "./src/schemas.ts" | ||
}, | ||
"./test-harness": { | ||
"import": "./src/test-harness.ts", | ||
"types": "./src/test-harness.ts" | ||
} | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf .turbo node_modules", | ||
"lint": "biome check . --write", | ||
|
@@ -27,6 +39,7 @@ | |
"devDependencies": { | ||
"@biomejs/biome": "^1.9.3", | ||
"@dotkomonline/config": "workspace:*", | ||
"@types/node": "^22.0.0", | ||
"@types/pg": "^8.10.9", | ||
"prisma": "^6.3.1", | ||
"tsx": "^4.19.3", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ generator zod { | |
provider = "zod-prisma-types" | ||
output = "../src/schemas" | ||
|
||
useMultipleFiles = true | ||
useMultipleFiles = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Node does not support directory import, and this codegenerator generates directory import when using multiple files. |
||
createInputTypes = false | ||
addIncludeType = false | ||
addSelectType = false | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { type Prisma, PrismaClient } from "@prisma/client" | ||
import { createRequire } from "node:module" | ||
import type { Prisma, PrismaClient } from "@prisma/client" | ||
import type { DefaultArgs } from "@prisma/client/runtime/library" | ||
|
||
export * as schemas from "./schemas" | ||
const require = createRequire(import.meta.url) | ||
const { Prisma: _Prisma, PrismaClient: _PrismaClient } = require("@prisma/client") | ||
export type * from "@prisma/client" | ||
|
||
export const PrismaRuntime = _Prisma | ||
export const PrismaClientRuntime = _PrismaClient | ||
export type DBClient = PrismaClient<Prisma.PrismaClientOptions, never, DefaultArgs> | ||
export const createPrisma = (databaseUrl: string): DBClient => | ||
new PrismaClient({ | ||
new _PrismaClient({ | ||
datasourceUrl: databaseUrl, | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * as schemas from "./schemas/index" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrites
../index
to../index.ts
for node imports. This means things work well with both next's build system and node --strip-experimental-types