Dockerfile for server build

This commit is contained in:
Liza 2023-02-09 22:07:09 +01:00
parent 25709f5530
commit f8b77b9aa9
6 changed files with 77 additions and 2 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
*/bin
*/obj
.git
.gitignore
Dockerfile
.dockerignore
.vs/

View File

@ -3,5 +3,6 @@
# Use with: # Use with:
# #
# $> git config core.hooksPath .githooks # $> git config core.hooksPath .githooks
# if ! git diff --cached --quiet -- "*.cs"; then
dotnet format --exclude vendor/ dotnet format --verbosity quiet --exclude vendor/
fi

27
.github/workflows/server.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Server
on:
push:
branches:
- master
paths-ignore:
- 'Pal.Client/**'
permissions:
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Package Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/${{ github.repository_owner }}/palace-pal:latest

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /build
COPY Pal.Common/Pal.Common.csproj Pal.Common/
COPY Pal.Server/Pal.Server.csproj Pal.Server/
RUN dotnet restore Pal.Server/Pal.Server.csproj
COPY . ./
RUN dotnet publish Pal.Server/Pal.Server.csproj -c Release -o /dist
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
EXPOSE 5415
ENV DOTNET_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=
ENV DATADIRECTORY=/data
ENV Kestrel__Endpoints__Http2__Url=http://+:5415
RUN adduser --uid 2000 --disabled-password --group --no-create-home --quiet --system pal
WORKDIR /app
COPY --from=build-env /dist .
USER pal
ENTRYPOINT ["dotnet", "Pal.Server.dll"]

View File

@ -11,7 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pal.Common", "Pal.Common\Pa
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{753F1752-AB41-4908-8359-C5809A79E5E7}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{753F1752-AB41-4908-8359-C5809A79E5E7}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
Dockerfile = Dockerfile
README.md = README.md README.md = README.md
.github\workflows\server.yml = .github\workflows\server.yml
EndProjectSection EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ECommons", "vendor\ECommons\ECommons\ECommons.csproj", "{D0B37096-5BC3-41B0-8D81-203CBA3932B0}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ECommons", "vendor\ECommons\ECommons\ECommons.csproj", "{D0B37096-5BC3-41B0-8D81-203CBA3932B0}"

View File

@ -9,3 +9,18 @@ To install this plugin from my plugin repository, please check the
Additionally, you **need to install Splatoon**, which is used to render the visible overlays. Additionally, you **need to install Splatoon**, which is used to render the visible overlays.
Please check [Splatoon's Installation Instructions](https://github.com/NightmareXIV/MyDalamudPlugins#installation). Please check [Splatoon's Installation Instructions](https://github.com/NightmareXIV/MyDalamudPlugins#installation).
## Server Installation
To run your own server, compile this plugin in DEBUG mode, load it as a dev plugin and configure the server as follows:
```sh
# create the directory for the sqlite db & some keys
mkdir data
# generate a random key (don't need to use openssl, any other base64 string is fine)
openssl rand -base64 48 > data/jwt.key
# start the server
docker run -it --rm -v "$(pwd)/data:/data" -p 127.0.0.1:5415:5415 ghcr.io/carvelli/palace-pal
```