Skip to content

Commit

Permalink
Merge pull request #706 from zerotacg/feature/create-docker-image
Browse files Browse the repository at this point in the history
Feature/create docker image
  • Loading branch information
zerotacg authored Jun 6, 2024
2 parents 83cc1c9 + a5021e6 commit 4b6707e
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,11 @@ jobs:
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}

- name: Package
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package

- uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.os }}
path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-*
112 changes: 112 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Publish Docker Image

on:
push:
branches: [ "core4" ]
tags:
- v*

env:
ubuntu_version: 22.04
build_type: Release
cpp_compiler: g++
c_compiler: gcc
IMAGE_NAME: ryzomcore-tools

jobs:
build:
runs-on: ubuntu-22.04
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v4
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "core4" ] && VERSION=latest
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo VERSION=$VERSION
echo IMAGE_ID=$IMAGE_ID
echo "build-version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "docker-image-tag=${IMAGE_ID}:${VERSION}" >> "$GITHUB_OUTPUT"
- name: Dependencies
run: |
sudo apt update
sudo apt install --yes software-properties-common
wget --quiet https://packages.microsoft.com/config/ubuntu/${{ env.ubuntu_version }}/packages-microsoft-prod.deb
sudo dpkg --install packages-microsoft-prod.deb
sudo apt update
sudo apt install --yes \
cmake build-essential ninja-build ccache \
bison autoconf automake \
libpng-dev \
libjpeg-dev \
libgif-dev libfreetype6-dev \
freeglut3-dev \
liblua5.2-dev libluabind-dev libcpptest-dev \
libogg-dev libvorbis-dev libopenal-dev \
libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \
libmysqlclient-dev \
libxml2-dev \
libcurl4-openssl-dev libssl-dev \
libsquish-dev \
liblzma-dev \
libgsf-1-dev \
qtbase5-dev qttools5-dev qttools5-dev-tools \
libmsquic
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/msquic_posix.h
wget https://raw.githubusercontent.com/microsoft/msquic/main/src/inc/quic_sal_stub.h
sudo mv msquic.h msquic_posix.h quic_sal_stub.h /usr/include/
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G "Ninja"
-DCMAKE_SUPPRESS_REGENERATION=ON
-DCMAKE_CXX_COMPILER=${{ env.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ env.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ env.build_type }}
-DWITH_STATIC=ON
-DWITH_NEL_SAMPLES=ON
-DWITH_LUA51=OFF
-DWITH_LUA52=ON
-DWITH_RYZOM=ON
-DWITH_RYZOM_SERVER=ON
-DWITH_RYZOM_CLIENT=ON
-DWITH_RYZOM_TOOLS=ON
-DWITH_NEL_TOOLS=ON
-DWITH_NELNS=ON
-DWITH_NELNS_LOGIN_SYSTEM=ON
-DWITH_NELNS_SERVER=ON
-DWITH_QT5=ON
-DWITH_LIBGSF=ON
-DCPACK_PACKAGE_VERSION="${{ steps.strings.outputs.build-version }}"
-DCPACK_GENERATOR=STGZ
-S ${{ github.workspace }}
- name: Package
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ env.build_type }} --target package

- uses: actions/upload-artifact@v4
with:
name: package
path: ${{ steps.strings.outputs.build-output-dir }}/ryzomcore-*

- name: Build the Docker image
run: docker build . --file docker/Dockerfile --tag "${{ steps.strings.outputs.docker-image-tag }}"

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push image
run: |
docker push "${{ steps.strings.outputs.docker-image-tag }}"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ IF(WIN32)
SET(CPACK_GENERATOR "NSIS;ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
ELSE()
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_GENERATOR "TGZ;STGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
ENDIF()
set(CPACK_SOURCE_IGNORE_FILES
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ services:
devcontainer:
image: "ryzomcore/devcontainer"
build: ./.devcontainer
volumes:
- ./:/tmp/ryzomcore

tools:
image: "ryzomcore/tools"
build:
context: .
dockerfile: docker/Dockerfile
36 changes: 36 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:22.04

ARG USERNAME=ryzom
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG APP_HOME=/app

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME

COPY build/ryzomcore-*.sh /tmp/ryzomcore.sh

RUN mkdir --parent "$APP_HOME" \
&& /tmp/ryzomcore.sh --skip-license

ENV LD_LIBRARY_PATH=/usr/local/lib

# install dependencies
RUN apt update; \
apt install --yes \
libcurl4 \
libfreetype6 \
libgif7 \
libgsf-1-114 \
libjpeg8 \
liblua5.2-0 \
libluabind0.9.1d1 \
libmysqlclient21 \
libpng16-16 \
libqt5widgets5 \
libsquish0 \
libvorbis0a \
libvorbisfile3 \
libxml2

USER $USERNAME

0 comments on commit 4b6707e

Please sign in to comment.