From de9419cfe45d0addad7d2f0a2bd6902c28c86f55 Mon Sep 17 00:00:00 2001 From: neverbot Date: Thu, 8 Feb 2024 17:49:40 +0100 Subject: [PATCH] feat: work with ghcr --- .github/workflows/publish-ghcr.yaml | 19 ++++++++++++++++++ Dockerfile | 30 +++++++++++++++++++++++++++++ README.md | 18 +++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 .github/workflows/publish-ghcr.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/publish-ghcr.yaml b/.github/workflows/publish-ghcr.yaml new file mode 100644 index 00000000..742c7ace --- /dev/null +++ b/.github/workflows/publish-ghcr.yaml @@ -0,0 +1,19 @@ +name: Build and Publish to Github Container Registry + +on: + push + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Login onto ghcr + run: | + docker login --username maldorne-bot --password ${{ secrets.MALDORNE_BOT_GHCR_TOKEN }} ghcr.io + - name: Build image + run: | + docker build --no-cache . -t ghcr.io/maldorne/dgd:latest + - name: Publish image + run: | + docker push ghcr.io/maldorne/dgd:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..1df4a51b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ + +# #### #### #### #### #### #### #### #### #### #### #### #### #### +# build using debian bookworm (12) +# #### #### #### #### #### #### #### #### #### #### #### #### #### + +FROM debian:12-slim + +# install needed tools +RUN apt-get update && apt-get install -y --force-yes git make gcc clang bison + +# create group and user, with uids +RUN groupadd -g 4200 mud +RUN useradd -u 4201 -g 4200 -ms /bin/bash mud +USER mud + +WORKDIR /opt/mud +COPY --chown=mud:mud . /opt/mud/driver/ + +WORKDIR /opt/mud/driver/src +RUN make clean +RUN make +RUN make install + +# let's copy the binary to the same directory as other images +RUN cp -R /opt/mud/driver/bin/ /opt/mud/ + +WORKDIR /opt/mud/ + +# expose telnet mudos ports +EXPOSE 5000/tcp diff --git a/README.md b/README.md index 16ec07c3..2885f544 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,21 @@ This distribution is organized as follows: command on Unix. - src/host Subdirectories for various platform-dependent files. + +### Added for the Maldorne fork + +- Build the container image (from project base directory) + + `docker build --no-cache . -t ghcr.io/maldorne/dgd:latest` + +- Run the container and take a look inside using a terminal + + `docker run --rm -ti ghcr.io/maldorne/dgd:latest /bin/bash` + + Inside the container, in `/opt/mud`, you can find the directories `driver` + (with the source code of DGD) and `bin`, with the binaries needed + to use DGD. + +- Publish the container in Docker Hub + + `docker push ghcr.io/maldorne/dgd:latest`