diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..324d4bf2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,30 @@ +# Node stuff that will be (re)installed inside image +node_modules +npm-debug.log +yarn-error.log + +# Build outputs / local dev artifacts +dist +/.astro +/.vercel +/.turbo + +# Git metadata +.git +.gitignore + +# Editor/OS cruft +.vscode/ +*.swp +.DS_Store + +# Local environment files (could contain secrets) +.env +.env.local +.env.*.local + +# Logs +*.log + +# Optional: if you have scripts or assets not needed in build context +tests/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7cb05120 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# Step 1: Build the Astro site +FROM node:18-alpine AS build + +# Set working directory +WORKDIR /app + +# Install dependencies +COPY package*.json ./ +RUN npm install + +# Copy all files +COPY . . + +# Expose default static site port +EXPOSE 10000 + +#run +# CMD ["npm", "run", "dev"] + +# # update in future +# # Step 2: Use a lightweight image to serve the site +# FROM node:18-alpine + +# # Install a static server (you could also use nginx here) +# RUN npm install -g serve + +# # Set working directory +# WORKDIR /app + +# # # Copy built files from previous stage +# COPY --from=build /app/dist . + +# # # Start the static server +# CMD ["serve", "-s", ".", "-l", "10000"] + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..9f6430cd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: '3.8' + +services: + astro: + build: . + ports: + - "3000:10000" diff --git a/package-lock.json b/package-lock.json index 6a677547..34867031 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ }, "devDependencies": { "@types/jest": "^29.5.12", + "@types/js-yaml": "^4.0.9", "@types/katex": "^0.16.7", "@types/node": "^20.14.9", "jest": "^29.7.0", @@ -2881,6 +2882,12 @@ "pretty-format": "^29.0.0" } }, + "node_modules/@types/js-yaml": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", + "dev": true + }, "node_modules/@types/katex": { "version": "0.16.7", "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.7.tgz", diff --git a/package.json b/package.json index 70be73e0..7a311c0c 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ }, "devDependencies": { "@types/jest": "^29.5.12", + "@types/js-yaml": "^4.0.9", "@types/katex": "^0.16.7", "@types/node": "^20.14.9", "jest": "^29.7.0", diff --git a/src/content/questions/comp2804/2013-fall-midterm/15/question.ts b/src/content/questions/comp2804/2013-fall-midterm/15/question.ts index 3af8a61a..ce3d801a 100644 --- a/src/content/questions/comp2804/2013-fall-midterm/15/question.ts +++ b/src/content/questions/comp2804/2013-fall-midterm/15/question.ts @@ -4,7 +4,7 @@ export const question: MultipleChoiceQuestion = { body: "If you flip a fair coin 4 times, what is the probability that the coin comes up heads exactly twice?", options: [ { label: "$1/{{4}\\choose{2}}$", correct: false }, - { label: "$2/2^{4}$", false: true }, + { label: "$2/2^{4}$", correct: true },// npm run build error due to false:true cahnged to correcT:true { label: "$2^{4}/{{4}\\choose{2}}$", correct: false }, { label: "${{4}\\choose{2}}/2^{4}$", correct: true }, ], diff --git a/src/pages/lectures.astro b/src/pages/lectures.astro index 8edda97a..c5923012 100644 --- a/src/pages/lectures.astro +++ b/src/pages/lectures.astro @@ -6,11 +6,21 @@ import fs from "fs"; import path from "path"; import yaml from "js-yaml"; + +//fixed type error in lectures +//downloaded js-yaml in package.json +interface Lecture{ + course: string; + link: string; + title: string; +} + + const filePath = path.resolve("src/data/lectures.yml"); const file = fs.readFileSync(filePath, "utf8"); -const lectures = yaml.load(file); +const lectures:Lecture[] = yaml.load(file) as Lecture[]; -const grouped = {}; +const grouped: Record = {}; for (const lec of lectures) { if (!grouped[lec.course]) grouped[lec.course] = []; grouped[lec.course].push(lec);