diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 055289ac..060d2e93 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -302,6 +302,34 @@ jobs: vc_redist_file_name: 'vc_redist.x86.exe' vc_vars: 'vcvars32.bat' +# +# Docker +# + +- job: BuildDockerImages + displayName: 'Build Docker Images' + pool: + vmImage: 'ubuntu-latest' + steps: + - task: UseDocker@0 + displayName: 'Set up Docker Buildx' + inputs: + command: 'setupBuildx' + buildxVersion: 'latest' + + - script: | + docker buildx create --use + docker buildx inspect --bootstrap + displayName: 'Create and Inspect Buildx Builder' + + - script: | + docker buildx build --no-cache --platform linux/amd64,linux/arm64 \ + --file $(Build.SourcesDirectory)/docker/Dockerfile \ + --file $(Build.SourcesDirectory)/docker/Dockerfile.aarch64 \ + -t yacreaderlibraryserver:develop \ + --output type=docker,dest=$(Build.ArtifactStagingDirectory)/multiarch.tar + displayName: 'Build and Push Multi-Platform Docker Image' + # # Dev builds publication # @@ -317,6 +345,7 @@ jobs: - Windows_x86 - Windows_x64 - Windows_x64_qt6 + - BuildDockerImages condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), true) variables: - group: github-releases @@ -327,6 +356,9 @@ jobs: inputs: buildType: 'current' targetPath: $(Build.ArtifactStagingDirectory) + - script: | + docker load -i $(Build.ArtifactStagingDirectory)/multiarch.tar + displayName: 'Load Multi-Platform Docker Image' - script: | find $(Build.ArtifactStagingDirectory) -name '*.*' -exec cp {} $(Build.ArtifactStagingDirectory) \; displayName: 'flatten artifact staging directory' @@ -334,7 +366,15 @@ jobs: VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' ).$(Build.BuildNumber)" echo "##vso[task.setvariable variable=VERSION]$VERSION" displayName: 'Version' - - task: GitHubRelease@0 + - task: Docker@2 + displayName: 'Push Multi-Platform Docker Image' + inputs: + command: 'push' + repository: yacreaderlibraryserver + tags: | + develop + containerRegistry: $(docker-hub) + - task: GitHubRelease@1 inputs: gitHubConnection: yacreader-releases repositoryName: YACReader/yacreader-dev-builds @@ -359,6 +399,7 @@ jobs: - Windows_x86 - Windows_x64 - Windows_x64_qt6 + - BuildDockerImages condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) variables: - group: github-releases @@ -369,6 +410,9 @@ jobs: inputs: buildType: 'current' targetPath: $(Build.ArtifactStagingDirectory) + - script: | + docker load -i $(Build.ArtifactStagingDirectory)/multiarch.tar + displayName: 'Load Multi-Platform Docker Image' - script: | find $(Build.ArtifactStagingDirectory) -name '*.*' -exec cp {} $(Build.ArtifactStagingDirectory) \; displayName: 'flatten artifact staging directory' @@ -376,7 +420,16 @@ jobs: VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )" echo "##vso[task.setvariable variable=VERSION]$VERSION" displayName: 'Version' - - task: GitHubRelease@0 + - task: Docker@2 + displayName: 'Push Multi-Platform Docker Image' + inputs: + command: 'push' + repository: yacreaderlibraryserver + tags: | + latest + $(VERSION) + containerRegistry: $(docker-hub) + - task: GitHubRelease@1 inputs: gitHubConnection: yacreader-releases title: $(VERSION) diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..43fb3517 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,102 @@ +FROM ghcr.io/linuxserver/baseimage-ubuntu:noble + +# version, it can be a TAG or a branch +ARG YACR_VERSION="develop" + +# env variables +ARG DEBIAN_FRONTEND="noninteractive" +ENV APPNAME="YACReaderLibraryServer" +ENV HOME="/config" +LABEL maintainer="luisangelsm" + +# install build & runtime packages +RUN \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential \ + desktop-file-utils \ + gcc \ + g++ \ + git \ + qt6-tools-dev \ + qt6-base-dev-tools \ + qmake6 \ + qmake6-bin \ + qt6-base-dev \ + qt6-multimedia-dev \ + qt6-tools-dev-tools \ + libgl-dev \ + qt6-l10n-tools \ + libqt6opengl6-dev \ + libunarr-dev \ + qt6-declarative-dev \ + libqt6svg6-dev \ + libqt6core5compat6-dev \ + libbz2-dev \ + libglu1-mesa-dev \ + liblzma-dev \ + libqt6gui6 \ + libqt6multimedia6 \ + libqt6network6 \ + libqt6qml6 \ + libqt6quickcontrols2-6 \ + qt6-image-formats-plugins \ + libqt6sql6 \ + libqt6sql6-sqlite \ + make \ + sqlite3 \ + libsqlite3-dev \ + unzip \ + wget \ + 7zip \ + 7zip-rar \ + libpoppler-qt6-dev \ + zlib1g-dev && \ + ldconfig + + +# clone YACReader repo +RUN git clone https://github.com/YACReader/yacreader.git /src/git && \ + cd /src/git && \ + git checkout $YACR_VERSION + +# get 7zip source +RUN cd /src/git/compressed_archive && \ + wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O /src/git/compressed_archive/7z2301-src.7z && \ + 7z x /src/git/compressed_archive/7z2301-src.7z -o/src/git/compressed_archive/lib7zip + +# build yacrederlibraryserver +RUN cd /src/git/YACReaderLibraryServer && \ + # qtchooser -list-versions && \ + qmake6 PREFIX=/app CONFIG+="7zip server_standalone" YACReaderLibraryServer.pro && \ + qmake6 -v && \ + make && \ + make install + +# clean up +RUN cd / && \ + apt-get clean && \ + apt-get purge -y build-essential g++ gcc git make qmake6 qtchooser unzip wget && \ + apt-get -y autoremove && \ + apt-get install -y --no-install-recommends \ + dos2unix \ + libqt6core5compat6-dev \ + libpoppler-qt6-dev && \ + rm -rf \ + /src \ + /tmp/* \ + /var/cache/apt \ + /var/lib/apt/lists/* + +# set ENV +ENV LC_ALL="en_US.UTF-8" \ + PATH="/app/bin:${PATH}" + +# copy files +COPY root.tar.gz / +# Extract the contents of root.tar.gz into the / directory +RUN tar -xvpzf /root.tar.gz -C / + +# ports and volumes +EXPOSE 8080 +VOLUME ["/config", "/comics"] diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 new file mode 100644 index 00000000..f7bc72ee --- /dev/null +++ b/docker/Dockerfile.aarch64 @@ -0,0 +1,91 @@ +FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-noble + +# version, it can be a TAG or a branch +ARG YACR_VERSION="develop" + +# env variables +ARG DEBIAN_FRONTEND="noninteractive" +ENV APPNAME="YACReaderLibraryServer" +ENV HOME="/config" +LABEL maintainer="luisangelsm" + +# install build & runtime packages +RUN \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential \ + desktop-file-utils \ + g++ \ + git \ + libglu1-mesa-dev \ + libpoppler-qt5-dev \ + libpoppler-qt5-1 \ + libqt5core5a \ + libqt5gui5 \ + libqt5multimedia5 \ + libqt5network5 \ + libqt5opengl5-dev \ + libqt5qml5 \ + libqt5quickcontrols2-5 \ + libqt5script5 \ + libqt5sql5-sqlite \ + libqt5sql5 \ + libqt5svg5-dev \ + libsqlite3-dev \ + make \ + 7zip \ + 7zip-rar \ + qtchooser \ + qtbase5-dev-tools \ + qt5-qmake \ + qtbase5-dev \ + qtmultimedia5-dev \ + qt5-image-formats-plugins \ + qtdeclarative5-dev \ + qtquickcontrols2-5-dev \ + qtscript5-dev \ + qttools5-dev-tools \ + sqlite3 \ + unzip \ + wget && \ + ldconfig + +# clone YACReader repo +RUN git clone https://github.com/YACReader/yacreader.git /src/git && \ + cd /src/git && \ + git checkout $YACR_VERSION + +# get 7zip source +RUN cd /src/git/compressed_archive && \ + wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O /src/git/compressed_archive/7z2301-src.7z && \ + 7z x /src/git/compressed_archive/7z2301-src.7z -o/src/git/compressed_archive/lib7zip + +# build yacreaderlibraryserver +RUN cd /src/git/YACReaderLibraryServer && \ + qmake PREFIX=/app CONFIG+="7zip server_standalone" YACReaderLibraryServer.pro && \ + make && \ + make install + +# clean up +RUN cd / && \ + apt-get clean && \ + apt-get purge -y build-essential g++ git make qt5-qmake unzip wget && \ + apt-get -y autoremove && \ + rm -rf \ + /src \ + /tmp/* \ + /var/cache/apt \ + /var/lib/apt/lists/* + +# set ENV +ENV LC_ALL="en_US.UTF-8" \ + PATH="/app/bin:${PATH}" + +# copy files +COPY root.tar.gz / +# Extract the contents of root.tar.gz into the / directory +RUN tar -xvpzf /root.tar.gz -C / + +# ports and volumes +EXPOSE 8080 +VOLUME ["/config", "/comics"] diff --git a/docker/root.tar.gz b/docker/root.tar.gz new file mode 100644 index 00000000..37913304 Binary files /dev/null and b/docker/root.tar.gz differ