Environment:
-
The CSV file is in the wwwroot folder.
-
Sqlite DB Connection string is in appsettings.json
Controllers:
- Create a controller for the entity (ex. Student)
dotnet aspnet-codegenerator controller -name StudentsController -async -m Student -dc ApplicationDbContext -outDir Controllers -sqlite
- Update the ChartsController according to the task.
Migrations and creating DB:
dotnet ef migrations add M1 -o Data/Migrations
dotnet-ef database update
Docker:
- Publish the app
./pblsh.sh
- Create the image and run the container locally to test it (Accessible on http://localhost:5000/)
docker compose up
- After:
docker compose down
- Create and tag the image for sending it to Docker hub
docker build --tag dotnetmidterm:1.0.0 .
- Login to your Docker account through terminal
docker login --username=[YOUR_USERNAME]
- Tag your image with your DockerID
docker tag dotnetmidterm:1.0.0 [YOUR_USERNAME]/dotnetmidterm:1.0.0
- Push the image to DockerHub
docker push [YOUR_USERNAME]/dotnetmidterm:1.0.0
- To run you image from DockerHub, remove the image locally and run the following command
docker run -d -p 8888:80 [YOUR_USERNAME]/dotnetmidterm:1.0.0