Skip to content

Build Docker NWNXEE Base Image #75

Build Docker NWNXEE Base Image

Build Docker NWNXEE Base Image #75

Workflow file for this run

name: Build Docker NWNXEE Base Image
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'base.Dockerfile'
- '**docker-base.yml'
- '**run-server.patch'
- 'CMakeLists.txt'
schedule:
- cron: '5 4 15 * *'
concurrency:
group: "build-base"
cancel-in-progress: false
jobs:
docker-base:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v3
- name: Set outputs
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "nwn_build=$(grep 'set(TARGET_NWN_BUILD ' CMakeLists.txt | cut -d' ' -f2 | sed 's/)//')" >> $GITHUB_OUTPUT
echo "nwn_build_revision=$(grep 'set(TARGET_NWN_BUILD_REVISION ' CMakeLists.txt | cut -d' ' -f2 | sed 's/)//')" >> $GITHUB_OUTPUT
echo "nwn_build_postfix=$(grep 'set(TARGET_NWN_BUILD_POSTFIX ' CMakeLists.txt | cut -d' ' -f2 | sed 's/)//')" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: ./
file: ./base.Dockerfile
build-args: NWSERVER_IMAGE=ghcr.io/urothis/nwserver:${{ steps.vars.outputs.nwn_build }}.${{ steps.vars.outputs.nwn_build_revision }}.${{ steps.vars.outputs.nwn_build_postfix }}
push: true
labels: |
org.opencontainers.image.title=NWNX:EE Base
org.opencontainers.image.description=This image is the base for NWNX:EE, it includes all the dependencies required to run NWNX and all plugins. It is used as an intermediary container before the freshly built binaries are placed.
org.opencontainers.image.author=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 }}
tags: |
${{ github.repository_owner }}/nwnxee-base:latest
${{ github.repository_owner }}/nwnxee-base:${{ steps.vars.outputs.sha_short }}
ghcr.io/${{ github.repository_owner }}/nwnxee-base:latest
ghcr.io/${{ github.repository_owner }}/nwnxee-base:${{ steps.vars.outputs.sha_short }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}