Skip to content

Commit

Permalink
Merge pull request #9 from jsknnr/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jsknnr authored Jan 22, 2024
2 parents 9fc02ea + 2d88104 commit faa7e01
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 23 deletions.
38 changes: 18 additions & 20 deletions .github/workflows/publish_image.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
name: Build and push Docker image

on:
push:
branches: [ main ]

env:
IMAGE_NAME: enshrouded-dedicated-server
release:
types: [created]

jobs:
build:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
- name: Build image
id: buildah
uses: redhat-actions/buildah-build@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
image: enshrouded-dedicated-server
context: ./container
containerfiles: Containerfile
tags: latest ${{ github.event.release.tag_name }} # Use latest and the release tag

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
- name: Push image to Docker Hub
uses: redhat-actions/push-to-registry@v2
with:
context: "{{defaultContext}}:docker"
push: true
tags: "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest"
image: ${{ steps.buildah.outputs.image }}
tags: ${{ steps.buildah.outputs.tags }}
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ The processes within the container do **NOT** run as root. Everything runs as th
To run the container in Docker, run the following command:

```bash
mkdir enshrouded-persistent-data
docker volume create enshrouded-persistent-data
docker run \
--detach \
--name enshrouded-server \
--mount type=bind,source=$(pwd)/enshrouded-persistent-data,target=/home/steam/enshrouded/savegame \
--mount type=volume,source=enshrouded-persistent-data,target=/home/steam/enshrouded/savegame \
--publish 15636:15636/udp \
--publish 15637:15637/udp \
--env=SERVER_NAME="Enshrouded Containerized Server" \
Expand All @@ -51,7 +51,39 @@ docker run \
sknnr/enshrouded-dedicated-server:latest
```

Where ever you create the `enshrouded-persistent-data` directory is where the world save is going to go. If you delete that directory you will lose your save. That directory will be mounted into the container.
### Docker Compose

To use Docker Compose, either clone this repo or copy the `compose.yaml` and `default.env` files out of the `container` directory to your local machine. You can leave the `compose.yaml` file uncahnged. Edit the `default.env` file to change the environment variables to the values you desire and then save the changes. Once you have made your changes, from the same directory that contains both the env file and the compose file, simply run:

```bash
docker compose up -d -f compose.yaml
```

To bring the container down:

```bash
docker compose down -f compose.yaml
```

### Podman

To run the container in Podman, run the following command:

```bash
podman volume create enshrouded-persistent-data
podman run \
--detach \
--name enshrouded-server \
--mount type=volume,source=enshrouded-persistent-data,target=/home/steam/enshrouded/savegame \
--publish 15636:15636/udp \
--publish 15637:15637/udp \
--env=SERVER_NAME="Enshrouded Containerized Server" \
--env=SERVER_SLOTS=16 \
--env=SERVER_PASSWORD="ChangeThisPlease" \
--env=GAME_PORT=15636 \
--env=QUERY_PORT=15637 \
docker.io/sknnr/enshrouded-dedicated-server:latest
```

### Kubernetes

Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions container/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
enshrouded:
image: sknnr/enshrouded-dedicated-server:latest
ports:
- "15636:15636/udp"
- "15637:15637/udp"
env_file:
- default.env
volumes:
- enshrouded-persistent-data:/home/steam/enshrouded/savegame

volumes:
enshrouded-persistent-data:
5 changes: 5 additions & 0 deletions container/default.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SERVER_NAME="Enshrouded Containerized"
SERVER_PASSWORD="PleaseChangeMe"
GAME_PORT="15636"
QUERY_PORT="15637"
SERVER_SLOTS="16"
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit faa7e01

Please sign in to comment.