4 Commits

Author SHA1 Message Date
3b901d8e6c 更新 .github/workflows/nightly-build.yaml
Some checks failed
Build and Push Docker Image to GHCR / build (push) Failing after 26s
Nightly-build / build (6.0.x) (push) Failing after 4m13s
2024-10-26 03:14:03 +08:00
9764484f4a 更新 .github/workflows/nightly-build.yaml
Some checks failed
Build and Push Docker Image to GHCR / build (push) Has been cancelled
2024-10-26 03:13:45 +08:00
5f781f6f48 更新 .github/workflows/nightly-build.yaml
Some checks failed
Build and Push Docker Image to GHCR / build (push) Failing after 1m28s
Nightly-build / build (6.0.x) (push) Failing after 2m6s
2024-10-26 03:08:06 +08:00
fcd7e18d9b Docker conversion of server component (#54)
* Docker conversion

* UDP not TCP

* Update docker-compose.yml
2024-04-14 10:59:43 +08:00
5 changed files with 82 additions and 40 deletions

32
.github/workflows/docker-build.yaml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Build and Push Docker Image to GHCR
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set repo owner to lowercase
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image to GHCR
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ env.REPO_OWNER }}/ragecoop-v:latest
dockerfile: Dockerfile

View File

@ -1,13 +1,11 @@
name: Nightly-build
on:
push:
branches: [ "dev-nightly" ]
on: push
jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['6.0.x']
@ -21,7 +19,10 @@ jobs:
- name: Restore dependencies
run: dotnet restore
- name: Restore nuget packages
run: nuget restore
run: |
sudo apt update
sudo apt install -y nuget
nuget restore
- name: Build client and installer
run: dotnet build RageCoop.Client.Installer/RageCoop.Client.Installer.csproj --configuration Release -o bin/Release/Client/RageCoop
- name: Build server win-x64
@ -41,37 +42,4 @@ jobs:
- uses: vimtor/action-zip@v1
with:
files: bin/Release/Server/linux-x64
dest: RageCoop.Server-linux-x64.zip
- uses: WebFreak001/deploy-nightly@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
with:
upload_url: https://uploads.github.com/repos/RAGECOOP/RAGECOOP-V/releases/70603992/assets{?name,label}
release_id: 70603992
asset_path: RageCoop.Client.zip
asset_name: RageCoop.Client.zip
asset_content_type: application/zip
max_releases: 7
- uses: WebFreak001/deploy-nightly@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
with:
upload_url: https://uploads.github.com/repos/RAGECOOP/RAGECOOP-V/releases/70603992/assets{?name,label}
release_id: 70603992
asset_path: RageCoop.Server-win-x64.zip
asset_name: RageCoop.Server-win-x64.zip
asset_content_type: application/zip
max_releases: 7
- uses: WebFreak001/deploy-nightly@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
with:
upload_url: https://uploads.github.com/repos/RAGECOOP/RAGECOOP-V/releases/70603992/assets{?name,label}
release_id: 70603992
asset_path: RageCoop.Server-linux-x64.zip
asset_name: RageCoop.Server-linux-x64.zip
asset_content_type: application/zip
max_releases: 7
dest: RageCoop.Server-linux-x64.zip

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
**/obj
**/packages
**/.vs
**/.vscode
**/.vscode
**/.idea

28
Dockerfile Normal file
View File

@ -0,0 +1,28 @@
# Use the official image as a parent image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
# Use the SDK image to build the app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /src
# Copy csproj and restore as distinct layers
COPY RageCoop.Server/*.csproj ./RageCoop.Server/
COPY libs/*.dll ./libs/
# Assuming RageCoop.Core is a dependency, if not, you can comment out the next line
COPY RageCoop.Core/*.csproj ./RageCoop.Core/
RUN dotnet restore RageCoop.Server/RageCoop.Server.csproj
# Copy everything else and build
COPY . .
WORKDIR /src/RageCoop.Server
RUN dotnet publish -c Release -o /app
# Build runtime image
FROM base AS final
WORKDIR /app
COPY --from=build-env /app .
ENTRYPOINT ["dotnet", "RageCoop.Server.dll"]

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
version: '3.8'
services:
ragecoop-v:
build:
context: .
dockerfile: Dockerfile
ports:
- "4499:4499/udp"
stdin_open: true
tty: true
volumes:
- ./Settings.xml:/app/Settings.xml