Add Dockerfile and documentation.
This commit is contained in:
parent
ef6adf0823
commit
7c0270e70d
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
|
# Ignore the tar file.
|
||||||
|
MusicAPI.tar
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
bin/
|
bin/
|
||||||
obj/
|
obj/
|
||||||
|
|||||||
4
Dockerfile
Normal file
4
Dockerfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||||
|
WORKDIR /app
|
||||||
|
COPY publish/ .
|
||||||
|
ENTRYPOINT ["dotnet", "MyApi.dll"]
|
||||||
26
README.md
26
README.md
@ -9,3 +9,29 @@ run project locally:
|
|||||||
* `dotnet run`
|
* `dotnet run`
|
||||||
|
|
||||||
## Deployment
|
## 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`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user