From 1a09b6a3dab9e49ad3f26f0135ec8bfc919eb4e2 Mon Sep 17 00:00:00 2001 From: Artur Motyka Date: Tue, 7 May 2024 15:39:27 +0200 Subject: [PATCH 1/4] Remove unused and old gitlab-ci manifest --- .gitlab-ci.yml | 502 ------------------------------------------------- 1 file changed, 502 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index d0e5bf86..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,502 +0,0 @@ -stages: - - build - - test - - package - - verify - - deploy - - testrepo - -variables: - EXMAPLE_REPO: "https://github.com/overviewer/Minecraft-Overviewer-Addons" - MC_VERSION: "1.12" - -build:linux: - image: registry.code.em32.net/overviewer/minecraft-overviewer:base - stage: build - dependencies: [] - tags: - - docker - cache: - key: "$CI_BUILD_REF_NAME-$CI_PIPELINE_ID-linuxbuild" - paths: - - overviewer_core/c_overviewer.so - - overviewer_core/overviewer_version.py - - overviewer_core/src/primitives.h - - build/ - script: - - python2 setup.py build - - python2 overviewer.py --verbose --version - -build:windows: - stage: build - dependencies: [] - tags: - - windows - script: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 - - set DISTUTILS_USE_SDK=1 - - set MSSdk=1 - - set PIL_INCLUDE_DIR=c:\devel\pillow\src\libImaging - - c:\Python27\python.exe c:\devel\virtualenv\virtualenv.py ci_env - - ci_env\scripts\pip.exe install numpy Pillow==5.1.0 - - ci_env\Scripts\python.exe setup.py build - - ci_env\Scripts\python.exe overviewer.py --verbose --version - - -build:docs: - image: registry.code.em32.net/overviewer/minecraft-overviewer:base - stage: build - dependencies: [] - tags: - - docker - script: - - cd docs - - make - artifacts: - name: "overviewer-docs" - expire_in: 2 weeks - paths: - - docs/_build/html/ - -test: - image: registry.code.em32.net/overviewer/minecraft-overviewer:base - stage: test - dependencies: [] - tags: - - docker - cache: - key: "$CI_BUILD_REF_NAME-$CI_PIPELINE_ID-linuxbuild" - paths: - - overviewer_core/c_overviewer.so - - overviewer_core/overviewer_version.py - - overviewer_core/src/primitives.h - - build/ - script: - - python2 setup.py build - - python2 test/test_all.py - - -render: - image: registry.code.em32.net/overviewer/minecraft-overviewer:base - stage: test - dependencies: [] - tags: - - docker - cache: - key: "$CI_BUILD_REF_NAME-$CI_PIPELINE_ID-linuxbuild" - paths: - - overviewer_core/c_overviewer.so - - overviewer_core/overviewer_version.py - - overviewer_core/src/primitives.h - - build/ - script: - - python2 setup.py build - - wget -N https://s3.amazonaws.com/Minecraft.Download/versions/${MC_VERSION}/${MC_VERSION}.jar -P ~/.minecraft/versions/${MC_VERSION}/ - - git clone --depth=1 ${EXMAPLE_REPO} maprepo - - export RENDER_DIR=render/ - - mkdir -p $RENDER_DIR - - python2 overviewer.py -p2 --rendermode=smooth_lighting maprepo/exmaple $RENDER_DIR - - zip -r render.zip $RENDER_DIR - artifacts: - expire_in: 2 days - paths: - - render.zip - - -# Builds a source package -pkg:src: - image: registry.code.em32.net/overviewer/minecraft-overviewer:base - stage: package - dependencies: [] - tags: - - docker - script: - - python2 setup.py sdist - - ls -lh dist - - mv dist/*.tar.gz . - artifacts: - expire_in: 2 weeks - paths: - - Minecraft-Overviewer*.tar.gz - -pkg:centos7rpm: - image: registry.code.em32.net/overviewer/minecraft-overviewer:centos7 - stage: package - dependencies: [] - tags: - - docker - script: - - export MCO_VERSION=`python2 setup.py --version` - - echo "Building Minecraft version ${MCO_VERSION}" - - mkdir -p ${HOME}/rpmbuild/SOURCES - - tar --transform 's,^,Minecraft-Overviewer/,S' -czf ${HOME}/rpmbuild/SOURCES/Minecraft-Overviewer-${MCO_VERSION}.tar.gz * - - sed s/{VERSION}/$MCO_VERSION/g build-tools/dockerfiles/centos7/Minecraft-Overviewer.spec > Minecraft-Overviewer.spec - - pwd - - rpmbuild -bs --define 'dist .centos7' Minecraft-Overviewer.spec - - /usr/bin/mock -r centos-7-x86_64 ${HOME}/rpmbuild/SRPMS/Minecraft-Overviewer-${MCO_VERSION}-1.centos7.src.rpm - - cp /var/lib/mock/centos-7-x86_64/result/Minecraft-Overviewer*.x86_64.rpm . - - ls -l *.rpm - artifacts: - expire_in: 2 weeks - paths: - - Minecraft-Overviewer*.x86_64.rpm - -pkg:centos7-32rpm: - image: registry.code.em32.net/overviewer/minecraft-overviewer:centos7 - stage: package - dependencies: [] - tags: - - docker - only: - - master - - triggers - script: - - export MCO_VERSION=`python2 setup.py --version` - - echo "Building Minecraft version ${MCO_VERSION}" - - mkdir -p ${HOME}/rpmbuild/SOURCES - - tar --transform 's,^,Minecraft-Overviewer/,S' -czf ${HOME}/rpmbuild/SOURCES/Minecraft-Overviewer-${MCO_VERSION}.tar.gz * - - sed s/{VERSION}/$MCO_VERSION/g build-tools/dockerfiles/centos7/Minecraft-Overviewer.spec > Minecraft-Overviewer.spec - - pwd - - rpmbuild -bs --define 'dist .centos7' Minecraft-Overviewer.spec - - /usr/bin/mock -r centos-7-i386 ${HOME}/rpmbuild/SRPMS/Minecraft-Overviewer-${MCO_VERSION}-1.centos7.src.rpm - - cp /var/lib/mock/centos-7-i386/result/Minecraft-Overviewer*.i*86.rpm . - - ls -l *.rpm - artifacts: - expire_in: 2 weeks - paths: - - Minecraft-Overviewer*.i*86.rpm - -# Note that even though we are building a centos6 rpm, we can still use the centos7 docker image -pkg:centos6rpm: - image: registry.code.em32.net/overviewer/minecraft-overviewer:centos7 - stage: package - dependencies: [] - tags: - - docker - only: - - master - - triggers - script: - - export MCO_VERSION=`python2 setup.py --version` - - echo "Building Minecraft version ${MCO_VERSION}" - - mkdir -p ${HOME}/rpmbuild/SOURCES - - tar --transform 's,^,Minecraft-Overviewer/,S' -czf ${HOME}/rpmbuild/SOURCES/Minecraft-Overviewer-${MCO_VERSION}.tar.gz * - - sed s/{VERSION}/$MCO_VERSION/g build-tools/dockerfiles/centos6/Minecraft-Overviewer.spec > Minecraft-Overviewer.spec - - pwd - - rpmbuild -bs --define 'dist .centos6' Minecraft-Overviewer.spec - - /usr/bin/mock -r centos-6-x86_64 ${HOME}/rpmbuild/SRPMS/Minecraft-Overviewer-${MCO_VERSION}-1.centos6.src.rpm - - cp /var/lib/mock/centos-6-x86_64/result/Minecraft-Overviewer*.x86_64.rpm . - - ls -l *.rpm - artifacts: - expire_in: 2 weeks - paths: - - Minecraft-Overviewer*.x86_64.rpm - -pkg:debian64: - image: registry.code.em32.net/overviewer/minecraft-overviewer:debian64 - stage: package - dependencies: [] - tags: - - docker - script: - - export MCO_VERSION=`python2 setup.py --version` - - echo "Building Minecraft version ${MCO_VERSION}" - - python setup.py build - - cp -r build-tools/dockerfiles/debian64 debian - - sh debian/generate_changelog.sh > debian/changelog - - cat debian/changelog - - debuild -i -us -uc -b - - mv ../*.deb . - - ls -l *.deb - artifacts: - expire_in: 2 weeks - paths: - - minecraft-overviewer*.deb - - -pkg:win64: - stage: package - dependencies: [] - tags: - - windows - script: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 - - set DISTUTILS_USE_SDK=1 - - set MSSdk=1 - - set PIL_INCLUDE_DIR=c:\devel\pillow\src\libImaging - - c:\Python27\python.exe c:\devel\virtualenv\virtualenv.py ci_env - - ci_env\scripts\pip.exe install numpy Pillow==5.1.0 pyinstaller sphinx - - ci_env\Scripts\python.exe setup.py build - - copy build-tools\overviewer.spec . - - ci_env\Scripts\pyinstaller.exe overviewer.spec - - for /f "delims=" %%a in ('ci_env\Scripts\python.exe setup.py --version') do @set OVR_VERSION=%%a - - ci_env\Scripts\sphinx-build.exe docs dist\overviewer-%OVR_VERSION%\docs - - rename dist dist-win64 - - ci_env\Scripts\python.exe -m zipfile -c overviewer-win64-%OVR_VERSION%.zip dist-win64\overviewer-%OVR_VERSION%\ - artifacts: - expire_in: 2 weeks - paths: - - overviewer-win64-*.zip - -pkg:win32: - stage: package - dependencies: [] - tags: - - windows - script: - - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 - - set DISTUTILS_USE_SDK=1 - - set MSSdk=1 - - set PIL_INCLUDE_DIR=c:\devel\pillow\src\libImaging - - "\"c:\\Python27 (x86)\\python.exe\" c:\\devel\\virtualenv\\virtualenv.py ci_env" - - ci_env\scripts\pip.exe install numpy Pillow==5.1.0 pyinstaller sphinx - - ci_env\Scripts\python.exe setup.py build - - copy build-tools\overviewer.spec . - - ci_env\Scripts\pyinstaller.exe overviewer.spec - - for /f "delims=" %%a in ('ci_env\Scripts\python.exe setup.py --version') do @set OVR_VERSION=%%a - - ci_env\Scripts\sphinx-build.exe docs dist\overviewer-%OVR_VERSION%\docs - - rename dist dist-win32 - - ci_env\Scripts\python.exe -m zipfile -c overviewer-win32-%OVR_VERSION%.zip dist-win32\overviewer-%OVR_VERSION%\ - artifacts: - expire_in: 2 weeks - paths: - - overviewer-win32-*.zip - -verify:centos7: - image: registry.code.em32.net/overviewer/minecraft-overviewer:centos7-verify - stage: verify - tags: - - docker - dependencies: - - pkg:centos7rpm - script: - - ls -l *.rpm - - ls -l - - echo yum -y install ./Minecraft-Overviewer-0*.rpm - - yum -y install ./Minecraft-Overviewer-0*.rpm - - which overviewer.py - - overviewer.py --verbose --version - - wget -N https://s3.amazonaws.com/Minecraft.Download/versions/${MC_VERSION}/${MC_VERSION}.jar -P ~/.minecraft/versions/${MC_VERSION}/ - - git clone --depth=1 ${EXMAPLE_REPO} maprepo - - overviewer.py --check-terrain --verbose - - -verify:debian64: - image: debian:jessie - stage: verify - tags: - - docker - dependencies: - - pkg:debian64 - script: - - apt-get -y update - - apt-get -y install wget git - - dpkg -i ./minecraft-overviewer*.deb || echo "" - - apt-get -y -f install - - which overviewer.py - - overviewer.py --verbose --version - - wget -N https://s3.amazonaws.com/Minecraft.Download/versions/${MC_VERSION}/${MC_VERSION}.jar -P ~/.minecraft/versions/${MC_VERSION}/ - - git clone --depth=1 ${EXMAPLE_REPO} maprepo - - overviewer.py --check-terrain --verbose - - - -deploy: - stage: deploy - tags: - - diax - - deploy - variables: - GIT_STRATEGY: none - dependencies: - - render - script: - - rm -rf render - - unzip render.zip - - mkdir -p /renders/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - - cp -r render/* /renders/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - - echo View render at http://static-backend.overviewer.org/renders/ci/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - -deploy:builds: - stage: deploy - tags: - - diax - - deploy - dependencies: - - build:docs - - pkg:src - - pkg:centos7rpm - - pkg:centos7-32rpm - - pkg:centos6rpm - - pkg:debian64 - - pkg:win64 - - pkg:win32 - script: - - ls -ltr - - mkdir -p /builds/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - - cp *.deb /builds/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - - cp *.rpm /builds/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - - cp overviewer*.zip /builds/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - - echo Artifacts copied to http://static-backend.overviewer.org/builds/$CI_BUILD_REF_SLUG/$CI_BUILD_ID/ - -deploy:repos: - stage: deploy - tags: - - diax - - deploy - only: - - master - dependencies: - - pkg:centos7rpm - - pkg:centos7-32rpm - - pkg:centos6rpm - - pkg:debian64 - script: - - ls -ltr - - dpkg-sig -g '--use-agent --batch --no-tty' --sign builder *.deb - - cp *.deb /repos/debian/files/ - - make -C /repos/debian/ -f /gitlab_runner/debian/Makefile - - /gitlab_runner/rpmsign.sh *.rpm - - cp *.el7.*.rpm /repos/rpm/7/x86_64/packages/ - - cp *.el6.*.rpm /repos/rpm/6/x86_64/packages/ - - make -C /repos/rpm/ -f /gitlab_runner/rpm/Makefile - - - -repo:centos7: - image: centos:7 - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - yum -y install wget - - wget -O /etc/yum.repos.d/overviewer.repo http://overviewer.org/rpms_new/overviewer.repo - - yum -y install Minecraft-Overviewer - - overviewer.py --verbose --version - -repo:centos6: - image: centos:6 - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - yum -y install wget - - wget -O /etc/yum.repos.d/overviewer.repo http://overviewer.org/rpms_new/overviewer.repo - - yum -y install Minecraft-Overviewer - - overviewer.py --verbose --version - -repo:fc25: - image: fedora:25 - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - yum -y install wget - - wget -O /etc/yum.repos.d/overviewer.repo http://overviewer.org/rpms_new/overviewer.repo - - yum -y install Minecraft-Overviewer - - overviewer.py --verbose --version - -repo:fc24: - image: fedora:24 - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - yum -y install wget - - wget -O /etc/yum.repos.d/overviewer.repo http://overviewer.org/rpms_new/overviewer.repo - - yum -y install Minecraft-Overviewer - - overviewer.py --verbose --version - -repo:fc23: - image: fedora:23 - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - yum -y install wget - - wget -O /etc/yum.repos.d/overviewer.repo http://overviewer.org/rpms_new/overviewer.repo - - yum -y install Minecraft-Overviewer - - overviewer.py --verbose --version - -repo:jessie: - image: debian:jessie - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - apt-get -y update - - apt-get -y install wget - - wget -O - http://overviewer.org/debian_new/overviewer.gpg.asc | apt-key add - - - echo 'deb http://overviewer.org/debian_new ./' >> /etc/apt/sources.list - - apt-get -y update - - apt-get -y install minecraft-overviewer - - overviewer.py --verbose --version - -repo:stretch: - image: debian:stretch - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - apt-get -y update - - apt-get -y install wget gnupg - - wget -O - http://overviewer.org/debian_new/overviewer.gpg.asc | apt-key add - - - echo 'deb http://overviewer.org/debian_new ./' >> /etc/apt/sources.list - - apt-get -y update - - apt-get -y install minecraft-overviewer - - overviewer.py --verbose --version - -repo:wheezy: - image: debian:wheezy - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - apt-get -y update - - apt-get -y install wget - - wget -O - http://overviewer.org/debian_new/overviewer.gpg.asc | apt-key add - - - echo 'deb http://overviewer.org/debian_new ./' >> /etc/apt/sources.list - - apt-get -y update - - apt-get -y install minecraft-overviewer - - overviewer.py --verbose --version - -repo:artful: - image: ubuntu:artful - stage: testrepo - dependencies: [] - tags: - - docker - only: - - master - script: - - apt-get -y update - - apt-get -y install wget - - wget -O - http://overviewer.org/debian_new/overviewer.gpg.asc | apt-key add - - - echo 'deb http://overviewer.org/debian_new ./' >> /etc/apt/sources.list - - apt-get -y update - - apt-get -y install minecraft-overviewer - - overviewer.py --verbose --version From e08cfd04b6df0e23bdb3386f99db536108ca8faf Mon Sep 17 00:00:00 2001 From: Artur Motyka Date: Tue, 7 May 2024 22:37:05 +0200 Subject: [PATCH 2/4] Add dockerfile, dockerignore and example docker-compose --- .dockerignore | 5 +++++ Dockerfile | 22 ++++++++++++++++++++ docker-compose.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..0d180b46 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +Dockerfile +docker-compose.yml +.github/ +docs/ +debian/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..05f6a63d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.8.19-bullseye AS build + +WORKDIR /usr/overviewer +COPY . /usr/overviewer/ + +RUN pip3 install -r requirements.txt + +# Copy required c headers +RUN curl -o Imaging.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/Imaging.h +RUN curl -o ImagingUtils.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImagingUtils.h +RUN curl -o ImPlatform.h https://raw.githubusercontent.com/python-pillow/Pillow/10.2.0/src/libImaging/ImPlatform.h + +# Build +RUN python setup.py build +RUN pyinstaller overviewer.spec + +# I've tried with alpine and distroless images, but there was a problem with missing libs. +FROM debian:12.5-slim +WORKDIR /usr/overviewer +COPY --from=build /usr/overviewer/dist/overviewer /usr/overviewer +USER 1000:1000 +ENTRYPOINT ["/usr/overviewer/overviewer"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..55ef1597 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,50 @@ +# Example docker-compose for running The-Minecraft-Overviewer +# Make sure to read it and modify to meet your needs. + +version: "3.8" +services: + # This container changes permissions for output directory and downloads 1.20.4 jar + # Make sure to include custom texturepath in your overviewer config, eq. texturepath = "/mnt/minecraft/.minecraft/versions/1.20.4/1.20.4.jar" + prepare-files: + image: alpine:3.18 + restart: "no" + entrypoint: | + /bin/sh -c " + echo asdf1 && + mkdir -p /mnt/minecraft/.minecraft/versions/1.20.4 && + echo asdf2 && + chown 1000:1000 -R /usr/overviewer/output && + echo asdf3 && + wget https://piston-data.mojang.com/v1/objects/fd19469fed4a4b4c15b2d5133985f0e3e7816a8a/client.jar -O /mnt/minecraft/.minecraft/versions/1.20.4/1.20.4.jar && + echo asdf4 && + chown 1000:1000 -R /mnt/minecraft && + echo asdf5 + " + volumes: + - overviewer-output:/usr/overviewer/output:rw + - minecraft-jars:/mnt/minecraft:rw + + overviewer: + # image: artur9010/overviewer:latest + build: . + depends_on: + - prepare-files + command: + - "-c" + - "config.py" + # Make a copy of sample_config.py and rename it to config.py. Make sure to modify paths inside of it. + volumes: + - overviewer-output:/usr/overviewer/output:rw + - /home/minecraft/minecraft:/usr/overviewer/server:ro + - minecraft-jars:/mnt/minecraft:rw + - ./config.py:/usr/overviewer/config.py:ro + nginx: + image: nginx + volumes: + - overviewer-output:/usr/share/nginx/html:ro + ports: + - "8080:80" + +volumes: + minecraft-jars: + overviewer-output: \ No newline at end of file From e37f70f95b07500e5eeb1a3cff478983a7c4105a Mon Sep 17 00:00:00 2001 From: Artur Motyka Date: Tue, 7 May 2024 22:40:54 +0200 Subject: [PATCH 3/4] Remove untested nginx from compose --- docker-compose.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 55ef1597..f35910be 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,12 +38,6 @@ services: - /home/minecraft/minecraft:/usr/overviewer/server:ro - minecraft-jars:/mnt/minecraft:rw - ./config.py:/usr/overviewer/config.py:ro - nginx: - image: nginx - volumes: - - overviewer-output:/usr/share/nginx/html:ro - ports: - - "8080:80" volumes: minecraft-jars: From 59f80ce5a52305a3d27bd289ad7698d9ffa7b1ca Mon Sep 17 00:00:00 2001 From: Artur Motyka Date: Tue, 7 May 2024 22:42:46 +0200 Subject: [PATCH 4/4] Remove "debugs" from prepare-files --- docker-compose.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f35910be..cf01bf8f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,15 +10,10 @@ services: restart: "no" entrypoint: | /bin/sh -c " - echo asdf1 && mkdir -p /mnt/minecraft/.minecraft/versions/1.20.4 && - echo asdf2 && chown 1000:1000 -R /usr/overviewer/output && - echo asdf3 && wget https://piston-data.mojang.com/v1/objects/fd19469fed4a4b4c15b2d5133985f0e3e7816a8a/client.jar -O /mnt/minecraft/.minecraft/versions/1.20.4/1.20.4.jar && - echo asdf4 && - chown 1000:1000 -R /mnt/minecraft && - echo asdf5 + chown 1000:1000 -R /mnt/minecraft " volumes: - overviewer-output:/usr/overviewer/output:rw