Skip to content

Commit b09854c

Browse files
git commit -m 'docker files'
1 parent 8de4414 commit b09854c

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

course-matrix/backend/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Use an official Node.js image
2+
FROM node:18
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy package.json and package-lock.json
8+
COPY package*.json ./
9+
10+
# Install dependencies
11+
RUN npm install
12+
13+
# Copy the rest of the application files
14+
COPY . .
15+
16+
# Create the .env file and write environment variables to it
17+
RUN echo "NODE_ENV=development" >> .env && \
18+
echo "PORT=8081" >> .env && \
19+
echo "CLIENT_APP_URL=http://localhost:5173" >> .env && \
20+
echo "DATABASE_URL=https://pmiihreibkvcruwhjvpj.supabase.co" >> .env && \
21+
echo "DATABASE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBtaWlocmVpYmt2Y3J1d2hqdnBqIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTczODE3NTMyNiwiZXhwIjoyMDUzNzUxMzI2fQ.hZ1goNXMKMfYDPyihsM5lZTh4i30BcEWMkJ7uJy1ddA" >> .env && \
22+
echo "OPENAI_API_KEY=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" >> .env && \
23+
echo "PINECONE_API_KEY=pcsk_49n8ja_Enwi4D5oNZSrebFePJYEK8bPzFs9eRBocjas4YSvPb5pBxD8qPHZPUVBwL4PDYQ" >> .env && \
24+
echo "PINECONE_INDEX_NAME=course-matrix" >> .env
25+
26+
# Expose the backend port
27+
EXPOSE 8081
28+
29+
# Start the application
30+
CMD ["npm", "run", "dev"]

course-matrix/docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3.8'
2+
3+
services:
4+
backend:
5+
build:
6+
context: ./backend
7+
ports:
8+
- "8081:8081"
9+
env_file:
10+
- ./backend/.env
11+
volumes:
12+
- ./backend:/app
13+
- /app/node_modules
14+
command: ["npm", "run", "dev"]
15+
16+
frontend:
17+
build:
18+
context: ./frontend
19+
args:
20+
VITE_SERVER_URL: "http://localhost:8081"
21+
ports:
22+
- "5173:5173"
23+
volumes:
24+
- ./frontend:/app
25+
- /app/node_modules
26+
command: ["npm", "run", "dev"]
27+
depends_on:
28+
- backend

course-matrix/frontend/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use an official Node.js image
2+
FROM node:18
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy package.json and package-lock.json
8+
COPY package*.json ./
9+
10+
# Install dependencies
11+
RUN npm install
12+
13+
# Copy the rest of the application files
14+
COPY . .
15+
16+
# Create the .env file and write environment variables to it
17+
RUN echo "VITE_SERVER_URL = http://localhost:8081" >> .env && \
18+
echo "VITE_PUBLIC_ASSISTANT_BASE_URL=https://proj-0typqkqr9yfy.assistant-api.com" >> .env && \
19+
echo "VITE_ASSISTANT_UI_KEY=sk_aui_proj_0typqkqr9yfy_04uORbQgEBNadpc0LmfPzMXxNLVJG0WL" >> .env
20+
21+
# Expose the backend port
22+
EXPOSE 8081
23+
24+
# Start the application
25+
CMD ["npm", "run", "dev"]

course-matrix/frontend/vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ export default defineConfig({
1010
"@": path.resolve(__dirname, "./src"),
1111
},
1212
},
13+
server: {
14+
host: "0.0.0.0", // Allow access from external devices
15+
port: 5173, // Ensure it's using the correct port
16+
strictPort: true, // Ensure it doesn't pick a different port if 5173 is in use
17+
open: false, // Prevent auto-opening a browser on the server
18+
},
1319
});

0 commit comments

Comments
 (0)