Skip to content

Edwin-Rugoogamu/AmonyCoffeeMIS

Repository files navigation

Instructions

Languages used: C#

Web framework: .NET 7

To run this project, do the following:

Download .NET 7 SDK here - https://dotnet.microsoft.com/en-us/download/dotnet/7.0

Run the installer and in the terminal run:

dotnet --version

Output should show the dotnet version installed

Within VS code terminal, run the following commands:

Build the app:

dotnet build

Install certs required for the app to run:

dotnet dev-certs https --trust

NB: After running this command, reopen your browser

Run the app:

dotnet run

Access the application on this URL: https://localhost:7208/

How to build and run the application using docker

click on a file and name it dockerfile configure the dockerfile in the following way

Use the official .NET SDK image as a build environment

 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env 

Set the working directory

WORKDIR /app

Copy the .csproj and restore dependencies

COPY *.csproj ./ RUN dotnet restore

Copy the main application source code

COPY . ./

RUN dotnet ef database update

Build the application

RUN dotnet publish -c Release -o out

Use the official runtime image

FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime

Set the working directory

WORKDIR /app

COPY --from=build-env /app/Data.db .

Copy the published application

COPY --from=build-env /app/out .

Specify the entry point for the container

ENTRYPOINT ["dotnet", "AmonyCoffeeMIS.dll"]

docker build -t AmonyCoffeeMI .

docker run -d -p 8080:80 AmonyCoffeeMI

8080 is where you can access the docker container . you can also decide on using another route eg 5000

in this case we are using sqlite.

pull or build the sqlite docker image to be used as the databse conatiner

docker pull keinos/sqlite3

docker run -d --name sqlite-container -v /path/to/database:/db keinos/sqlite3

docker exec -it sqlite-container sqlite3 /db/mydatabase.db

Build a network that can run both containers

docker network create my-network

docker run -d -p 8080:80 --network my-network --name AmonyCoffeeMI AmonyCoffeeMI

docker run -d --network my-network --name keinos/sqlite3 keinos/sqlite3

version: '3'

services: AmonyCoffeeMI: image: AmonyCoffeeMI ports: - "8080:80" networks: - my-network

keinos/sqlite3: image: keinos/sqlite3 networks: - my-network

networks: my-network:

run both containers

docker-compose up

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published