Skip to content

Commit

Permalink
prepare docker image and push to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
zerotacg committed May 16, 2024
1 parent bcd2893 commit 4e40767
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ env:
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
Expand Down Expand Up @@ -81,10 +85,29 @@ jobs:
-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 ryzomcore:${{ steps.strings.outputs.build-version }}

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

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION="${{ steps.strings.outputs.build-version }}"
echo IMAGE_ID=$IMAGE_ID
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
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
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ services:
build: ./.devcontainer
volumes:
- ./:/tmp/ryzomcore

tools:
image: "ryzomcore/tools"
build:
context: .
dockerfile: docker/Dockerfile
6 changes: 4 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ ARG APP_HOME=/app
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME

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

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

USER $USERNAME
WORKDIR $APP_HOME

0 comments on commit 4e40767

Please sign in to comment.