Disclaimer: During the creation of this project code, LLM was used.
This project will be a starting point for a web application with authorization and authentification set up. Backend will be in dotnet, backed by a Postgres db.
We want to need minimal setup on the developer machine when working using this project. Therefore, everything will be ready to build and run using docker images.
Build and run dev:
docker-compose -f docker/docker-compose.dev.yml up --build
Build and run prod:
docker-compose -f docker/docker-compose.prod.yml up --build
To run tools, like generating migrations, build
docker build --target development-tools -f docker/dockerfile -t loginnet-dev-tools .
and run
docker run --rm -v "$PWD/src/server:/app" -v "/app/obj" -w "/app" loginnet-dev-tools dotnet ...
Backend template generation using docker image:
docker run --rm \
-v "$PWD:/workdir" \
-w "/workdir" \
mcr.microsoft.com/dotnet/sdk:10.0 \
dotnet new web -o server
Runs dotnet new web -o server using the dotnet-sdk docker container inside /workdir directory. Current $PWD is mapped to the /workdir.
There is no need for launchSettings.json to set port and everything. When run through docker, it uses values set by env variables.
The app does not take care of tls and does not expose https port. This should be a job of a reverse proxy.
We ignore ./src/server/bin and ./src/server/obj in docker build (do not copy from build context to the image). Some tools (vscode+omnisharp) create these automatically even when we do not build localy. However, during the build of the docker, we want the dotnet to create its own. Also, during dev, when we map ./src, we want to avoid mapping these, so not to mix these.
- In dev, we mount the /src/server so that the container works with the files on our filesystem, this allows us to update files in real time
- We need to find a way to stop
binandobjfrom being synced with our filesystem. Ideally completely change their location in docker