diff --git a/.gitignore b/.gitignore index b6b4e4f..c7a9b45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Ignore the tar file. +MusicAPI.tar + # Build results bin/ obj/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d353bef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY publish/ . +ENTRYPOINT ["dotnet", "MyApi.dll"] \ No newline at end of file diff --git a/README.md b/README.md index dad5879..90086c7 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,29 @@ run project locally: * `dotnet run` ## Deployment + +Publish project: +* `dotnet publish -c Release -o publish` + +Build the container: +* `docker build -t music_api:latest .` + +Export image to a file: +* `docker save music_api:latest -o MusicAPI.tar` + +* Transer the file to USB, then run commands on the server. + +Load devices: +* `lsblk` + +Usually it is `sdb1`, mount it to a created mount point. + +* `sudo mount /dev/sdb1 /mnt/usb` +* `cp /mnt/usb/MusicAPI.tar ~/` +* `sudo umount /mnt/usb` + +Load image on server: +* `docker load -i MusicAPI.tar` + +Run container on server: +* `docker run -d -p 8080:80 --name MusicAPI music_api:latest`