Skip to content

Commit

Permalink
CI: Use the new nwnxee-base image to base our final image upon
Browse files Browse the repository at this point in the history
  • Loading branch information
plenarius committed Nov 16, 2020
1 parent 9c698bb commit c713a55
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 66 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/build.yml
Expand Up @@ -123,26 +123,38 @@ jobs:
working-directory: ${{runner.workspace}}/unified/Binaries
run: cmake -E tar cfv ../NWNX-EE.zip --format=zip .

- name: Pack the Binaries for Docker
if: github.event_name == 'push'
working-directory: ${{runner.workspace}}/unified/Binaries
run: cmake -E tar cfv ../NWNX-EE.tar .

- name: Pack the Scripts
if: github.event_name == 'push'
working-directory: ${{runner.workspace}}/unified
shell: bash
run: zip -j ./NWScript.zip `find . -name "*.nss" | grep -Pv '_t+[0-9]{0,1}.nss'`

- name: Upload Binaries
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
if: github.event_name == 'push'
with:
path: ./NWNX-EE.zip
name: NWNX-EE.zip

- name: Upload Scripts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
if: github.event_name == 'push'
with:
path: ./NWScript.zip
name: NWScript.zip

- name: Upload Tar Binaries for Docker
uses: actions/upload-artifact@v2
if: github.event_name == 'push'
with:
name: NWNX-EE.tar
path: ./NWNX-EE.tar

- name: Deploy Latest Development Build
uses: "marvinpinto/action-automatic-releases@latest"
if: github.event_name == 'push'
Expand All @@ -164,12 +176,14 @@ jobs:

- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Download Binaries
uses: actions/download-artifact@v2
with:
name: NWNX-EE.zip
name: NWNX-EE.tar

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -194,6 +208,16 @@ jobs:
context: ./
file: ./gha.Dockerfile
push: true
build-args: NWNXEE_BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/nwnxee-base
labels: |
org.opencontainers.image.title=NWNX:EE
org.opencontainers.image.description=This is the NWNX:EE image. NWNX:EE is a framework that developers can use to modify existing hardcoded rules or inject brand new functionality into Neverwinter Nights: Enhanced edition.
org.opencontainers.image.author=NWNX:EE Community
org.opencontainers.image.vendor=NWNX:EE Community
org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/unified
org.opencontainers.image.created=${{ steps.vars.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.documentation=https://nwnxee.github.io/unified
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ steps.vars.outputs.sha_short }}
Expand Down
31 changes: 2 additions & 29 deletions Dockerfile
@@ -1,5 +1,5 @@
# This image is for users who wish to build their images themselves. It uses the builder factory that is created
# via the builder.Dockerfile
# via the builder.Dockerfile and the base that is created via the base.Dockerfile

FROM nwnxee/builder as builder
WORKDIR /nwnx/home
Expand All @@ -11,36 +11,9 @@ ARG CXX=g++
ENV CXX=$CXX
RUN Scripts/buildnwnx.sh -j $(nproc)

FROM beamdog/nwserver:8193.16
RUN mkdir -p /nwn/nwnx
FROM nwnxee/nwnxee-base
COPY --from=builder /nwnx/home/Binaries/* /nwn/nwnx/

# Install plugin run dependencies
RUN runDeps="hunspell \
libmariadb3 \
libpq5 \
libsqlite3-0 \
libruby2.5 \
luajit libluajit-5.1 \
libssl1.1 \
inotify-tools \
patch \
unzip \
dotnet-runtime-5.0 \
dotnet-apphost-pack-5.0" \
installDeps="ca-certificates wget" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $installDeps \
&& wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get -y install --no-install-recommends $runDeps \
&& rm -rf /var/cache/apt /var/lib/apt/lists/*

# Patch run-server.sh with our modifications
COPY --from=builder /nwnx/home/Scripts/Docker/run-server.patch /nwn/
RUN patch /nwn/run-server.sh < /nwn/run-server.patch

# Configure nwserver to run with nwnx
ENV NWNX_CORE_LOAD_PATH=/nwn/nwnx/
ENV NWN_LD_PRELOAD="/nwn/nwnx/NWNX_Core.so"
Expand Down
37 changes: 4 additions & 33 deletions gha.Dockerfile
@@ -1,39 +1,10 @@
# This image is created after a Github Actions build, we use the artifacts from
# This image is created after a Github Actions build and should only be used then. We use the artifacts from
# that build instead of rebuilding from source again then push our image to Dockerhub and GHCR.

FROM beamdog/nwserver:8193.16
ARG NWNXEE_BASE_IMAGE=nwnxee/nwnxee-base
FROM $NWNXEE_BASE_IMAGE
RUN mkdir -p /nwn/nwnx
COPY ./NWNX-EE.zip /nwn/nwnx

# Install plugin run dependencies
RUN runDeps="hunspell \
libmariadb3 \
libpq5 \
libsqlite3-0 \
libruby2.5 \
luajit libluajit-5.1 \
libssl1.1 \
inotify-tools \
patch \
unzip \
dotnet-runtime-5.0 \
dotnet-apphost-pack-5.0" \
installDeps="ca-certificates wget" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $installDeps \
&& wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get -y install --no-install-recommends $runDeps \
&& ln -s /usr/lib/x86_64-linux-gnu/libmariadb.so.3 /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18 \
&& rm -rf /var/cache/apt /var/lib/apt/lists/*

# Unzip the built binaries from Github Actions
RUN unzip /nwn/nwnx/NWNX-EE.zip -d /nwn/nwnx && rm /nwn/nwnx/NWNX-EE.zip

# Patch run-server.sh with our modifications
COPY ./Scripts/Docker/run-server.patch /nwn
RUN patch /nwn/run-server.sh < /nwn/run-server.patch
ADD ./NWNX-EE.tar /nwn/nwnx

# Configure nwserver to run with nwnx
ENV NWNX_CORE_LOAD_PATH=/nwn/nwnx/
Expand Down

0 comments on commit c713a55

Please sign in to comment.