Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Add Dockerfiles #78

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.12-slim
EXPOSE 8000
COPY . /backend
WORKDIR /backend
RUN pip install -r requirements.txt
CMD uvicorn --host 0.0.0.0 app:app
6 changes: 4 additions & 2 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from routes.teacher import teacher_router
from routes.user import users_router

app = FastAPI()
app = FastAPI(docs_url="/api/docs")

# Koppel routes uit andere modules.
app.include_router(student_router, prefix="/api")
Expand All @@ -23,10 +23,11 @@
app.include_router(subject_router, prefix="/api")
app.include_router(group_router, prefix="/api")

DEBUG = False # Should always be false in repo
DEBUG = False # Should always be false in repo

if DEBUG:
from fastapi.middleware.cors import CORSMiddleware

origins = [
"https://localhost",
"https://localhost:8080",
Expand All @@ -41,6 +42,7 @@
allow_headers=["*"],
)


# Koppel de exception handlers
@app.exception_handler(InvalidRoleCredentialsError)
def invalid_admin_credentials_error_handler(request: Request, exc: InvalidRoleCredentialsError) -> JSONResponse:
Expand Down
8 changes: 8 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:20 AS builder
COPY . /app
WORKDIR /app
RUN npm install
RUN npm run build
FROM nginx
RUN sed -E 's/(index index.html) index.htm;/\1; try_files $uri \/index.html;/' -i /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
3 changes: 3 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.