Skip to content

Commit c5f7f66

Browse files
committed
Dockerfile added, DockerIgnore added, Docker compose added, fixed a little bit of npm run build errors
1 parent d728b12 commit c5f7f66

File tree

7 files changed

+94
-3
lines changed

7 files changed

+94
-3
lines changed

.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Node stuff that will be (re)installed inside image
2+
node_modules
3+
npm-debug.log
4+
yarn-error.log
5+
6+
# Build outputs / local dev artifacts
7+
dist
8+
/.astro
9+
/.vercel
10+
/.turbo
11+
12+
# Git metadata
13+
.git
14+
.gitignore
15+
16+
# Editor/OS cruft
17+
.vscode/
18+
*.swp
19+
.DS_Store
20+
21+
# Local environment files (could contain secrets)
22+
.env
23+
.env.local
24+
.env.*.local
25+
26+
# Logs
27+
*.log
28+
29+
# Optional: if you have scripts or assets not needed in build context
30+
tests/

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Step 1: Build the Astro site
2+
FROM node:18-alpine AS build
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Install dependencies
8+
COPY package*.json ./
9+
RUN npm install
10+
11+
# Copy all files
12+
COPY . .
13+
14+
# Expose default static site port
15+
EXPOSE 10000
16+
17+
#run
18+
# CMD ["npm", "run", "dev"]
19+
20+
# # update in future
21+
# # Step 2: Use a lightweight image to serve the site
22+
# FROM node:18-alpine
23+
24+
# # Install a static server (you could also use nginx here)
25+
# RUN npm install -g serve
26+
27+
# # Set working directory
28+
# WORKDIR /app
29+
30+
# # # Copy built files from previous stage
31+
# COPY --from=build /app/dist .
32+
33+
# # # Start the static server
34+
# CMD ["serve", "-s", ".", "-l", "10000"]
35+
36+

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3.8'
2+
3+
services:
4+
astro:
5+
build: .
6+
ports:
7+
- "3000:10000"

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"devDependencies": {
3535
"@types/jest": "^29.5.12",
36+
"@types/js-yaml": "^4.0.9",
3637
"@types/katex": "^0.16.7",
3738
"@types/node": "^20.14.9",
3839
"jest": "^29.7.0",

src/content/questions/comp2804/2013-fall-midterm/15/question.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const question: MultipleChoiceQuestion = {
44
body: "If you flip a fair coin 4 times, what is the probability that the coin comes up heads exactly twice?",
55
options: [
66
{ label: "$1/{{4}\\choose{2}}$", correct: false },
7-
{ label: "$2/2^{4}$", false: true },
7+
{ label: "$2/2^{4}$", correct: true },// npm run build error due to false:true cahnged to correcT:true
88
{ label: "$2^{4}/{{4}\\choose{2}}$", correct: false },
99
{ label: "${{4}\\choose{2}}/2^{4}$", correct: true },
1010
],

src/pages/lectures.astro

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ import fs from "fs";
66
import path from "path";
77
import yaml from "js-yaml";
88
9+
10+
//fixed type error in lectures
11+
//downloaded js-yaml in package.json
12+
interface Lecture{
13+
course: string;
14+
link: string;
15+
title: string;
16+
}
17+
18+
919
const filePath = path.resolve("src/data/lectures.yml");
1020
const file = fs.readFileSync(filePath, "utf8");
11-
const lectures = yaml.load(file);
21+
const lectures:Lecture[] = yaml.load(file) as Lecture[];
1222
13-
const grouped = {};
23+
const grouped: Record<string, Lecture[]> = {};
1424
for (const lec of lectures) {
1525
if (!grouped[lec.course]) grouped[lec.course] = [];
1626
grouped[lec.course].push(lec);

0 commit comments

Comments
 (0)