Merge remote-tracking branch 'upstream/general-devel' into add-moondial-permission
This commit is contained in:
commit
69636c4417
5 changed files with 47 additions and 11 deletions
25
.github/workflows/ci-docker.yml
vendored
Normal file
25
.github/workflows/ci-docker.yml
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
name: CI (Docker image)
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Build image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7,windows/amd64
|
||||||
|
push: false
|
||||||
|
pull: true
|
||||||
|
cache-from: type=gha, scope=${{ github.workflow }}
|
||||||
|
cache-to: type=gha, scope=${{ github.workflow }}
|
||||||
10
Dockerfile
10
Dockerfile
|
|
@ -1,10 +1,8 @@
|
||||||
ARG TARGETPLATFORM=linux/amd64
|
# TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx.
|
||||||
ARG BUILDPLATFORM=${TARGETPLATFORM}
|
# They should not be set in the global scope manually.
|
||||||
|
|
||||||
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder
|
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
|
||||||
|
|
||||||
# Copy build context
|
# Copy build context
|
||||||
WORKDIR /TShock
|
WORKDIR /TShock
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
@ -12,6 +10,10 @@ COPY . ./
|
||||||
# Build and package release based on target architecture
|
# Build and package release based on target architecture
|
||||||
RUN dotnet build -v m
|
RUN dotnet build -v m
|
||||||
WORKDIR /TShock/TShockLauncher
|
WORKDIR /TShock/TShockLauncher
|
||||||
|
|
||||||
|
# Make TARGETPLATFORM available to the container.
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
case "${TARGETPLATFORM}" in \
|
case "${TARGETPLATFORM}" in \
|
||||||
"linux/amd64") export ARCH="linux-x64" \
|
"linux/amd64") export ARCH="linux-x64" \
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TextLog : ILog, IDisposable
|
public class TextLog : ILog, IDisposable
|
||||||
{
|
{
|
||||||
private readonly StreamWriter _logWriter;
|
private readonly bool ClearFile;
|
||||||
|
private StreamWriter _logWriter;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// File name of the Text log
|
/// File name of the Text log
|
||||||
|
|
@ -44,7 +45,7 @@ namespace TShockAPI
|
||||||
public TextLog(string filename, bool clear)
|
public TextLog(string filename, bool clear)
|
||||||
{
|
{
|
||||||
FileName = filename;
|
FileName = filename;
|
||||||
_logWriter = new StreamWriter(filename, !clear);
|
ClearFile = clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MayWriteType(TraceLevel type)
|
public bool MayWriteType(TraceLevel type)
|
||||||
|
|
@ -247,6 +248,10 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (!MayWriteType(level))
|
if (!MayWriteType(level))
|
||||||
return;
|
return;
|
||||||
|
if (_logWriter is null)
|
||||||
|
{
|
||||||
|
_logWriter = new StreamWriter(FileName, !ClearFile);
|
||||||
|
}
|
||||||
|
|
||||||
var caller = "TShock";
|
var caller = "TShock";
|
||||||
|
|
||||||
|
|
@ -278,7 +283,10 @@ namespace TShockAPI
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logWriter.Dispose();
|
if (_logWriter != null)
|
||||||
|
{
|
||||||
|
_logWriter.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
|
||||||
* Added a method `TSPlayer.UpdateSection` with arguments `rectangle` and `isLoaded`, which will load some area from the server to the player. (@AgaSpace)
|
* Added a method `TSPlayer.UpdateSection` with arguments `rectangle` and `isLoaded`, which will load some area from the server to the player. (@AgaSpace)
|
||||||
* Added a method `TSPlayer.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@AgaSpace)
|
* Added a method `TSPlayer.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@AgaSpace)
|
||||||
* Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace)
|
* Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace)
|
||||||
|
* Fixed bug where when the `UseSqlLogs` config property is true, an empty log file would still get created. (@ZakFahey)
|
||||||
* Fixed typo in `/gbuff`. (@sgkoishi, #2955)
|
* Fixed typo in `/gbuff`. (@sgkoishi, #2955)
|
||||||
* Rewrote the `.dockerignore` file into a denylist. (@timschumi)
|
* Rewrote the `.dockerignore` file into a denylist. (@timschumi)
|
||||||
* Added a new permission, `tshock.world.time.usemoondial`, for regulating use of Enchanted Moondial. (@Arthri)
|
* Added a new permission, `tshock.world.time.usemoondial`, for regulating use of Enchanted Moondial. (@Arthri)
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,15 @@ Open ports can also be passed through using `-p <host_port>:<container_port>`.
|
||||||
|
|
||||||
For Example:
|
For Example:
|
||||||
```bash
|
```bash
|
||||||
# Building the image
|
# Building the image using buildx and loading it into docker
|
||||||
docker build -t tshock:linux-amd64 --build-arg TARGETPLATFORM=linux/amd64 .
|
docker buildx build -t tshock:latest --load .
|
||||||
|
|
||||||
# Running the image
|
# Running the image
|
||||||
docker run -p 7777:7777 -p 7878:7878 \
|
docker run -p 7777:7777 -p 7878:7878 \
|
||||||
-v /home/cider/tshock/:/tshock \
|
-v /home/cider/tshock/:/tshock \
|
||||||
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
|
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
|
||||||
-v /home/cider/tshock/plugins:/plugins \
|
-v /home/cider/tshock/plugins:/plugins \
|
||||||
--rm -it tshock:linux-amd64 \
|
--rm -it tshock:latest \
|
||||||
-world /worlds/backflip.wld -motd "OMFG DOCKER"
|
-world /worlds/backflip.wld -motd "OMFG DOCKER"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ Using `docker buildx`, you could build [multi-platform images](https://docs.dock
|
||||||
For Example:
|
For Example:
|
||||||
```bash
|
```bash
|
||||||
# Building the image using buildx and loading it into docker
|
# Building the image using buildx and loading it into docker
|
||||||
sudo docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
|
docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
|
||||||
|
|
||||||
# Running the image
|
# Running the image
|
||||||
docker run -p 7777:7777 -p 7878:7878 \
|
docker run -p 7777:7777 -p 7878:7878 \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue