-
Notifications
You must be signed in to change notification settings - Fork 10
feat: add dockerfile #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jackblk
wants to merge
19
commits into
BattleBit-Community-Servers:main
Choose a base branch
from
jackblk:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3ee9129
feat: add dockerfile
jackblk a743cbc
feat: add docker build workflow
jackblk c7eaf54
fix: missing workflow trigger
jackblk cb5d3e5
feat: change default ip to localhost
jackblk 85d249c
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk 626b7f3
feat: rootless user, better data structure
jackblk abdd649
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk 656c380
feat: update docker img to 0.4.10
jackblk d61eb48
feat: docker img support arm64
jackblk 67c452c
feat: add volume
jackblk 2abeca6
feat: tag docker image
jackblk afd9084
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk b3193ca
feat: docker build from source
jackblk e9bfa18
refactor: simplify build path
jackblk c1f14b8
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk 2e50a3b
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk 65ed188
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk 0196727
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk 7ebe6df
Merge branch 'BattleBit-Community-Servers:main' into main
jackblk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,284 @@ | ||
| # Created by https://www.gitignore.io/api/csharp | ||
|
|
||
| ### Csharp ### | ||
| ## Ignore Visual Studio temporary files, build results, and | ||
| ## files generated by popular Visual Studio add-ons. | ||
|
|
||
| # User-specific files | ||
| *.suo | ||
| *.user | ||
| *.userosscache | ||
| *.sln.docstates | ||
|
|
||
| # User-specific files (MonoDevelop/Xamarin Studio) | ||
| *.userprefs | ||
|
|
||
| # Build results | ||
| [Dd]ebug/ | ||
| [Dd]ebugPublic/ | ||
| [Rr]elease/ | ||
| [Rr]eleases/ | ||
| x64/ | ||
| x86/ | ||
| bld/ | ||
| [Bb]in/ | ||
| [Oo]bj/ | ||
| [Ll]og/ | ||
|
|
||
| # Visual Studio 2015 cache/options directory | ||
| .vs/ | ||
| # Uncomment if you have tasks that create the project's static files in wwwroot | ||
| #wwwroot/ | ||
|
|
||
| # MSTest test Results | ||
| [Tt]est[Rr]esult*/ | ||
| [Bb]uild[Ll]og.* | ||
|
|
||
| # NUNIT | ||
| *.VisualState.xml | ||
| TestResult.xml | ||
|
|
||
| # Build Results of an ATL Project | ||
| [Dd]ebugPS/ | ||
| [Rr]eleasePS/ | ||
| dlldata.c | ||
|
|
||
| # DNX | ||
| project.lock.json | ||
| project.fragment.lock.json | ||
| artifacts/ | ||
| Properties/launchSettings.json | ||
|
|
||
| *_i.c | ||
| *_p.c | ||
| *_i.h | ||
| *.ilk | ||
| *.meta | ||
| *.obj | ||
| *.pch | ||
| *.pdb | ||
| *.pgc | ||
| *.pgd | ||
| *.rsp | ||
| *.sbr | ||
| *.tlb | ||
| *.tli | ||
| *.tlh | ||
| *.tmp | ||
| *.tmp_proj | ||
| *.log | ||
| *.vspscc | ||
| *.vssscc | ||
| .builds | ||
| *.pidb | ||
| *.svclog | ||
| *.scc | ||
|
|
||
| # Chutzpah Test files | ||
| _Chutzpah* | ||
|
|
||
| # Visual C++ cache files | ||
| ipch/ | ||
| *.aps | ||
| *.ncb | ||
| *.opendb | ||
| *.opensdf | ||
| *.sdf | ||
| *.cachefile | ||
| *.VC.db | ||
| *.VC.VC.opendb | ||
|
|
||
| # Visual Studio profiler | ||
| *.psess | ||
| *.vsp | ||
| *.vspx | ||
| *.sap | ||
|
|
||
| # TFS 2012 Local Workspace | ||
| $tf/ | ||
|
|
||
| # Guidance Automation Toolkit | ||
| *.gpState | ||
|
|
||
| # ReSharper is a .NET coding add-in | ||
| _ReSharper*/ | ||
| *.[Rr]e[Ss]harper | ||
| *.DotSettings.user | ||
|
|
||
| # JustCode is a .NET coding add-in | ||
| .JustCode | ||
|
|
||
| # TeamCity is a build add-in | ||
| _TeamCity* | ||
|
|
||
| # DotCover is a Code Coverage Tool | ||
| *.dotCover | ||
|
|
||
| # Visual Studio code coverage results | ||
| *.coverage | ||
| *.coveragexml | ||
|
|
||
| # NCrunch | ||
| _NCrunch_* | ||
| .*crunch*.local.xml | ||
| nCrunchTemp_* | ||
|
|
||
| # MightyMoose | ||
| *.mm.* | ||
| AutoTest.Net/ | ||
|
|
||
| # Web workbench (sass) | ||
| .sass-cache/ | ||
|
|
||
| # Installshield output folder | ||
| [Ee]xpress/ | ||
|
|
||
| # DocProject is a documentation generator add-in | ||
| DocProject/buildhelp/ | ||
| DocProject/Help/*.HxT | ||
| DocProject/Help/*.HxC | ||
| DocProject/Help/*.hhc | ||
| DocProject/Help/*.hhk | ||
| DocProject/Help/*.hhp | ||
| DocProject/Help/Html2 | ||
| DocProject/Help/html | ||
|
|
||
| # Click-Once directory | ||
| publish/ | ||
|
|
||
| # Publish Web Output | ||
| *.[Pp]ublish.xml | ||
| *.azurePubxml | ||
| # TODO: Comment the next line if you want to checkin your web deploy settings | ||
| # but database connection strings (with potential passwords) will be unencrypted | ||
| *.pubxml | ||
| *.publishproj | ||
|
|
||
| # Microsoft Azure Web App publish settings. Comment the next line if you want to | ||
| # checkin your Azure Web App publish settings, but sensitive information contained | ||
| # in these scripts will be unencrypted | ||
| PublishScripts/ | ||
|
|
||
| # NuGet Packages | ||
| *.nupkg | ||
| # The packages folder can be ignored because of Package Restore | ||
| **/packages/* | ||
| # except build/, which is used as an MSBuild target. | ||
| !**/packages/build/ | ||
| # Uncomment if necessary however generally it will be regenerated when needed | ||
| #!**/packages/repositories.config | ||
| # NuGet v3's project.json files produces more ignoreable files | ||
| *.nuget.props | ||
| *.nuget.targets | ||
|
|
||
| # Microsoft Azure Build Output | ||
| csx/ | ||
| *.build.csdef | ||
|
|
||
| # Microsoft Azure Emulator | ||
| ecf/ | ||
| rcf/ | ||
|
|
||
| # Windows Store app package directories and files | ||
| AppPackages/ | ||
| BundleArtifacts/ | ||
| Package.StoreAssociation.xml | ||
| _pkginfo.txt | ||
|
|
||
| # Visual Studio cache files | ||
| # files ending in .cache can be ignored | ||
| *.[Cc]ache | ||
| # but keep track of directories ending in .cache | ||
| !*.[Cc]ache/ | ||
|
|
||
| # Others | ||
| ClientBin/ | ||
| ~$* | ||
| *~ | ||
| *.dbmdl | ||
| *.dbproj.schemaview | ||
| *.jfm | ||
| *.pfx | ||
| *.publishsettings | ||
| node_modules/ | ||
| orleans.codegen.cs | ||
|
|
||
| # Since there are multiple workflows, uncomment next line to ignore bower_components | ||
| # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) | ||
| #bower_components/ | ||
|
|
||
| # RIA/Silverlight projects | ||
| Generated_Code/ | ||
|
|
||
| # Backup & report files from converting an old project file | ||
| # to a newer Visual Studio version. Backup files are not needed, | ||
| # because we have git ;-) | ||
| _UpgradeReport_Files/ | ||
| Backup*/ | ||
| UpgradeLog*.XML | ||
| UpgradeLog*.htm | ||
|
|
||
| # SQL Server files | ||
| *.mdf | ||
| *.ldf | ||
|
|
||
| # Business Intelligence projects | ||
| *.rdl.data | ||
| *.bim.layout | ||
| *.bim_*.settings | ||
|
|
||
| # Microsoft Fakes | ||
| FakesAssemblies/ | ||
|
|
||
| # GhostDoc plugin setting file | ||
| *.GhostDoc.xml | ||
|
|
||
| # Node.js Tools for Visual Studio | ||
| .ntvs_analysis.dat | ||
|
|
||
| # Visual Studio 6 build log | ||
| *.plg | ||
|
|
||
| # Visual Studio 6 workspace options file | ||
| *.opt | ||
|
|
||
| # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) | ||
| *.vbw | ||
|
|
||
| # Visual Studio LightSwitch build output | ||
| **/*.HTMLClient/GeneratedArtifacts | ||
| **/*.DesktopClient/GeneratedArtifacts | ||
| **/*.DesktopClient/ModelManifest.xml | ||
| **/*.Server/GeneratedArtifacts | ||
| **/*.Server/ModelManifest.xml | ||
| _Pvt_Extensions | ||
|
|
||
| # Paket dependency manager | ||
| .paket/paket.exe | ||
| paket-files/ | ||
|
|
||
| # FAKE - F# Make | ||
| .fake/ | ||
|
|
||
| # JetBrains Rider | ||
| .idea/ | ||
| *.sln.iml | ||
|
|
||
| # CodeRush | ||
| .cr/ | ||
|
|
||
| # Python Tools for Visual Studio (PTVS) | ||
| __pycache__/ | ||
| *.pyc | ||
|
|
||
| # Cake - Uncomment if you are using it | ||
| # tools/ | ||
| tools/Cake.CoreCLR | ||
| .vscode | ||
| tools | ||
| .dotnet | ||
| Dockerfile | ||
|
|
||
| # .env file contains default environment variables for docker | ||
| .env | ||
| .git/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Build Docker Image | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - "main" | ||
| tags: | ||
| - "*" | ||
|
|
||
| jobs: | ||
| build-docker-img: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v2 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| # - name: Login to DockerHub | ||
| # uses: docker/login-action@v2 | ||
| # with: | ||
| # username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| # password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Docker meta | ||
| id: meta | ||
| uses: docker/metadata-action@v4 | ||
| with: | ||
| images: ghcr.io/${{ github.repository_owner }}/battlebit-api-runner | ||
| tags: | | ||
| type=ref,event=tag | ||
| type=ref,event=branch | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v4 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Base image | ||
| FROM mcr.microsoft.com/dotnet/sdk:6.0 AS base | ||
|
|
||
| WORKDIR /app | ||
| COPY . . | ||
| RUN dotnet publish -c Release --output ./bld/ BattleBitAPIRunner.sln | ||
|
|
||
| # App image | ||
| FROM mcr.microsoft.com/dotnet/runtime:6.0 AS app | ||
|
|
||
| ARG UNAME=bbr | ||
| ARG UID=1000 | ||
| ARG GID=1000 | ||
|
|
||
| RUN groupadd -g $GID -o $UNAME \ | ||
| && useradd -l -u $UID -g $GID -o -s /bin/bash $UNAME | ||
|
|
||
| WORKDIR /app | ||
| COPY --from=base --chown=$UID:$GID /app/bld /app | ||
| COPY --chown=$UID:$GID docker/appsettings.json /app/appsettings.json | ||
| RUN mkdir -p data/modules data/dependencies data/configurations\ | ||
| && chown -R $UID:$GID /app | ||
|
|
||
| USER $UID:$GID | ||
|
|
||
| VOLUME ["/app/data"] | ||
|
|
||
| CMD ["dotnet", "BattleBitAPIRunner.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "IP": "0.0.0.0", | ||
| "Port": 29999, | ||
| "ModulesPath": "./data/modules", | ||
| "DependencyPath": "./data/dependencies", | ||
| "ConfigurationPath": "./data/configurations" | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.