Upgraded alpine images
This commit is contained in:
+1
-35
@@ -17,18 +17,12 @@ if(ENABLE_TESTS)
|
||||
find_package(GTest REQUIRED)
|
||||
endif()
|
||||
|
||||
# Common dependencies
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Filesystem REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS system program_options iostreams)
|
||||
find_package(Wt REQUIRED COMPONENTS Wt Dbo DboSqlite3 HTTP)
|
||||
pkg_check_modules(Taglib REQUIRED IMPORTED_TARGET taglib)
|
||||
pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++)
|
||||
pkg_check_modules(GraphicsMagick++ IMPORTED_TARGET GraphicsMagick++)
|
||||
pkg_check_modules(LIBAV IMPORTED_TARGET libavcodec libavutil libavformat)
|
||||
pkg_check_modules(Archive REQUIRED IMPORTED_TARGET libarchive)
|
||||
find_package(PAM)
|
||||
find_package(STB)
|
||||
|
||||
# WT
|
||||
if (NOT Wt_FOUND)
|
||||
@@ -47,34 +41,6 @@ if (NOT TARGET Wt::HTTP)
|
||||
message(FATAL_ERROR "Cannot find Wt::HTTP!")
|
||||
endif ()
|
||||
|
||||
# PAM
|
||||
option(USE_PAM "Use the PAM backend authentication API" ON)
|
||||
if (USE_PAM AND NOT PAM_FOUND)
|
||||
message(WARNING "PAM library not found: disabling")
|
||||
set(USE_PAM OFF)
|
||||
endif ()
|
||||
if (USE_PAM)
|
||||
message(STATUS "Using PAM authentication backend")
|
||||
else ()
|
||||
message(STATUS "NOT using PAM authentication backend")
|
||||
endif ()
|
||||
|
||||
# IMAGE
|
||||
if (STB_FOUND)
|
||||
set(IMAGE_LIBRARY STB CACHE STRING "STB library")
|
||||
elseif (GraphicsMagick++_FOUND)
|
||||
set(IMAGE_LIBRARY GraphicsMagick++ CACHE STRING "GraphicsMagick++")
|
||||
else ()
|
||||
message(FATAL_ERROR "Cannot find suitable image library")
|
||||
endif()
|
||||
set_property(CACHE IMAGE_LIBRARY PROPERTY STRINGS GraphicsMagick++ STB)
|
||||
if (IMAGE_LIBRARY STREQUAL GraphicsMagick++ AND NOT GraphicsMagick++_FOUND)
|
||||
message(FATAL_ERROR "GraphicsMagick++ not found")
|
||||
elseif (IMAGE_LIBRARY STREQUAL STB AND NOT STB_FOUND)
|
||||
message(FATAL_ERROR "STB not found")
|
||||
endif ()
|
||||
message(STATUS "IMAGE_LIBRARY set to ${IMAGE_LIBRARY}")
|
||||
|
||||
# Benchmark
|
||||
option(BUILD_BENCHMARKS "Build benchmarks" OFF)
|
||||
if (BUILD_BENCHMARKS)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
|
||||
FROM --platform=$BUILDPLATFORM alpine:3.18
|
||||
FROM --platform=$BUILDPLATFORM alpine:3.19
|
||||
|
||||
ARG BUILD_PACKAGES="\
|
||||
clang \
|
||||
@@ -36,7 +36,7 @@ ARG LMS_BUILD_TYPE="Release"
|
||||
RUN \
|
||||
DIR=/tmp/lms/build && mkdir -p ${DIR} && cd ${DIR} && \
|
||||
xx-info is-cross && export BUILD_TESTS=OFF || export BUILD_TESTS=ON && \
|
||||
PKG_CONFIG_PATH=/$(xx-info)/usr/lib/pkgconfig cmake /tmp/lms/ -DCMAKE_INCLUDE_PATH=${PREFIX}/include -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} $(xx-clang --print-cmake-defines) -DCMAKE_PREFIX_PATH=/$(xx-info)/usr/lib/cmake -DBUILD_TESTING=${BUILD_TESTS} -DBUILD_BENCHMARKS=ON && \
|
||||
PKG_CONFIG_PATH=/$(xx-info)/usr/lib/pkgconfig cmake /tmp/lms/ -DCMAKE_INCLUDE_PATH=/$(xx-info)/usr/include -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} $(xx-clang --print-cmake-defines) -DCMAKE_PREFIX_PATH=/$(xx-info)/usr/lib/cmake -DBUILD_TESTING=${BUILD_TESTS} -DBUILD_BENCHMARKS=ON && \
|
||||
VERBOSE=1 make -j$(nproc) && \
|
||||
xx-verify src/lms/lms && \
|
||||
(xx-info is-cross || make test)
|
||||
|
||||
@@ -23,6 +23,6 @@ COPY . /tmp/lms/
|
||||
ARG LMS_BUILD_TYPE="Release"
|
||||
RUN \
|
||||
DIR=/tmp/lms/build && mkdir -p ${DIR} && cd ${DIR} && \
|
||||
cmake /tmp/lms/ -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_BENCHMARKS=ON && \
|
||||
cmake /tmp/lms/ -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/usr -DLMS_IMAGE_BACKEND=graphicsmagick -DBUILD_BENCHMARKS=ON && \
|
||||
VERBOSE=1 make -j$(nproc) && \
|
||||
make test
|
||||
|
||||
+5
-6
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.18 AS build
|
||||
FROM alpine:3.19 AS build
|
||||
|
||||
WORKDIR /tmp/workdir
|
||||
|
||||
@@ -37,7 +37,7 @@ ARG BUILD_PACKAGES=" \
|
||||
RUN apk add --no-cache --update ${BUILD_PACKAGES}
|
||||
|
||||
# ffmpeg
|
||||
ARG FFMPEG_VERSION=4.3.5
|
||||
ARG FFMPEG_VERSION=6.1.1
|
||||
RUN \
|
||||
DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \
|
||||
curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
|
||||
@@ -79,7 +79,7 @@ RUN \
|
||||
make distclean
|
||||
|
||||
# WT
|
||||
ARG WT_VERSION=4.10.2
|
||||
ARG WT_VERSION=4.10.4
|
||||
RUN \
|
||||
DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \
|
||||
curl -sLO https://github.com/emweb/wt/archive/${WT_VERSION}.tar.gz && \
|
||||
@@ -92,7 +92,7 @@ RUN \
|
||||
make install
|
||||
|
||||
# STB
|
||||
ARG STB_VERSION=5736b15f7ea0ffb08dd38af21067c314d6a3aae9
|
||||
ARG STB_VERSION=ae721c50eaf761660b4f90cc590453cdb0c2acd0
|
||||
RUN \
|
||||
DIR=/tmp/stb && mkdir -p ${DIR} && cd ${DIR} && \
|
||||
curl -sLO https://github.com/nothings/stb/archive/${STB_VERSION}.tar.gz && \
|
||||
@@ -134,7 +134,7 @@ RUN \
|
||||
rm -rf /tmp/fakeroot/share/Wt/resources/themes
|
||||
|
||||
## Release Stage
|
||||
FROM alpine:3.18 AS release
|
||||
FROM alpine:3.19 AS release
|
||||
LABEL maintainer="Emeric Poupon <itmfr@yahoo.fr>"
|
||||
|
||||
ARG RUNTIME_PACKAGES=" \
|
||||
@@ -179,4 +179,3 @@ COPY --from=build /tmp/fakeroot/share/lms/lms.conf /etc/lms.conf
|
||||
EXPOSE 5082
|
||||
|
||||
ENTRYPOINT ["/usr/bin/lms"]
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
||||
```
|
||||
__Notes__:
|
||||
* you can customize the installation directory using `-DCMAKE_INSTALL_PREFIX=path` (defaults to `/usr/local`).
|
||||
* you can customize the image library using `-DIMAGE_LIBRARY=<STB|GraphicsMagick++>`
|
||||
* you can customize the image library using `-DLMS_IMAGE_BACKEND=<stb|graphicsmagick>` (defaults to `stb`)
|
||||
```sh
|
||||
make
|
||||
```
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
find_path(STB_INCLUDE_DIR stb_image.h PATH_SUFFIXES stb)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
STB
|
||||
REQUIRED_VARS STB_INCLUDE_DIR
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
find_path(STB_IMAGE_INCLUDE_DIR stb_image.h PATH_SUFFIXES stb)
|
||||
|
||||
find_path(STB_IMAGE_RESIZE2_INCLUDE_DIR stb_image_resize2.h PATH_SUFFIXES stb)
|
||||
if(STB_IMAGE_RESIZE2_INCLUDE_DIR)
|
||||
set(STB_IMAGE_RESIZE_VERSION 2)
|
||||
else()
|
||||
find_path(STB_IMAGE_RESIZE_INCLUDE_DIR stb_image_resize.h PATH_SUFFIXES stb)
|
||||
if(STB_IMAGE_RESIZE_INCLUDE_DIR)
|
||||
set(STB_IMAGE_RESIZE_VERSION 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
StbImage
|
||||
REQUIRED_VARS STB_IMAGE_INCLUDE_DIR STB_IMAGE_RESIZE_VERSION
|
||||
)
|
||||
@@ -1,3 +1,4 @@
|
||||
pkg_check_modules(LIBAV IMPORTED_TARGET libavcodec libavutil libavformat)
|
||||
|
||||
add_library(lmsav SHARED
|
||||
impl/AudioFile.cpp
|
||||
@@ -27,4 +28,3 @@ target_link_libraries(lmsav PRIVATE
|
||||
)
|
||||
|
||||
install(TARGETS lmsav DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++)
|
||||
pkg_check_modules(Archive REQUIRED IMPORTED_TARGET libarchive)
|
||||
|
||||
add_library(lmscore SHARED
|
||||
impl/http/Client.cpp
|
||||
impl/http/SendQueue.cpp
|
||||
|
||||
@@ -17,23 +17,33 @@ target_link_libraries(lmsimage PUBLIC
|
||||
std::filesystem
|
||||
)
|
||||
|
||||
if (IMAGE_LIBRARY STREQUAL STB)
|
||||
set(LMS_IMAGE_BACKEND "stb" CACHE STRING "Image library")
|
||||
set_property(CACHE LMS_IMAGE_BACKEND PROPERTY STRINGS "stb" "graphicsmagick")
|
||||
|
||||
if (${LMS_IMAGE_BACKEND} STREQUAL "stb")
|
||||
find_package(StbImage REQUIRED)
|
||||
message(STATUS "Using stb (resize version ${STB_IMAGE_RESIZE_VERSION})")
|
||||
|
||||
target_sources(lmsimage PRIVATE
|
||||
impl/stb/JPEGImage.cpp
|
||||
impl/stb/RawImage.cpp
|
||||
)
|
||||
target_compile_options(lmsimage PRIVATE "-DLMS_SUPPORT_IMAGE_STB")
|
||||
target_include_directories(lmsimage PRIVATE ${STB_INCLUDE_DIR})
|
||||
elseif (IMAGE_LIBRARY STREQUAL GraphicsMagick++)
|
||||
)
|
||||
target_compile_options(lmsimage PRIVATE "-DSTB_IMAGE_RESIZE_VERSION=${STB_IMAGE_RESIZE_VERSION}")
|
||||
target_include_directories(lmsimage PRIVATE ${STB_IMAGE_INCLUDE_DIR})
|
||||
|
||||
elseif (${LMS_IMAGE_BACKEND} STREQUAL "graphicsmagick")
|
||||
pkg_check_modules(GraphicsMagick++ REQUIRED IMPORTED_TARGET GraphicsMagick++)
|
||||
message(STATUS "Using graphicsmagick")
|
||||
|
||||
target_sources(lmsimage PRIVATE
|
||||
impl/graphicsmagick/JPEGImage.cpp
|
||||
impl/graphicsmagick/RawImage.cpp
|
||||
)
|
||||
target_compile_options(lmsimage PRIVATE "-DLMS_SUPPORT_IMAGE_GM")
|
||||
)
|
||||
target_link_libraries(lmsimage PRIVATE PkgConfig::GraphicsMagick++)
|
||||
|
||||
else ()
|
||||
message(FATAL_ERROR "Invalid IMAGE_LIBRARY provided")
|
||||
endif()
|
||||
message(FATAL_ERROR "Invalid image library")
|
||||
endif ()
|
||||
|
||||
install(TARGETS lmsimage DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef LMS_SUPPORT_IMAGE_GM
|
||||
#error "Bad configuration"
|
||||
#endif
|
||||
|
||||
#include <Magick++.h>
|
||||
|
||||
#include "image/IEncodedImage.hpp"
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef LMS_SUPPORT_IMAGE_GM
|
||||
#error "Bad configuration"
|
||||
#endif
|
||||
|
||||
#include <Magick++.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -28,7 +28,13 @@
|
||||
#define STBI_FAILURE_USERMSG
|
||||
|
||||
#include <stb_image.h>
|
||||
#if STB_IMAGE_RESIZE_VERSION == 1
|
||||
#include <stb_image_resize.h>
|
||||
#elif STB_IMAGE_RESIZE_VERSION == 2
|
||||
#include <stb_image_resize2.h>
|
||||
#else
|
||||
#error "Unhandled STB image resize version"!
|
||||
#endif
|
||||
|
||||
#include "core/ITraceLogger.hpp"
|
||||
#include "image/Exception.hpp"
|
||||
@@ -94,9 +100,17 @@ namespace lms::image::STB
|
||||
if (!resizedData)
|
||||
throw Exception{ "Cannot allocate memory for resized image!" };
|
||||
|
||||
#if STB_IMAGE_RESIZE_VERSION == 1
|
||||
if (::stbir_resize_uint8_srgb(reinterpret_cast<const unsigned char*>(_data.get()), _width, _height, 0,
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
3, STBIR_ALPHA_CHANNEL_NONE, 0) == 0)
|
||||
#elif STB_IMAGE_RESIZE_VERSION == 2
|
||||
if (::stbir_resize_uint8_srgb(reinterpret_cast<const unsigned char*>(_data.get()), _width, _height, 0,
|
||||
reinterpret_cast<unsigned char*>(resizedData.get()), width, height, 0,
|
||||
STBIR_RGB) == 0)
|
||||
#else
|
||||
#error "Unhandled STB image resize version"!
|
||||
#endif
|
||||
{
|
||||
throw Exception{ "Failed to resize image:" + std::string{ ::stbi_failure_reason() } };
|
||||
}
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef LMS_SUPPORT_IMAGE_STB
|
||||
#error "Bad configuration"
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
pkg_check_modules(Taglib REQUIRED IMPORTED_TARGET taglib)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
|
||||
@@ -27,6 +27,22 @@ target_link_libraries(lmsauth PUBLIC
|
||||
Boost::system
|
||||
Wt::Wt
|
||||
)
|
||||
|
||||
# PAM
|
||||
option(USE_PAM "Use the PAM backend authentication API" ON)
|
||||
if (USE_PAM)
|
||||
find_package(PAM QUIET)
|
||||
if (USE_PAM AND NOT PAM_FOUND)
|
||||
message(WARNING "PAM library not found: disabling")
|
||||
set(USE_PAM OFF)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (USE_PAM)
|
||||
message(STATUS "Using PAM authentication backend")
|
||||
else ()
|
||||
message(STATUS "NOT using PAM authentication backend")
|
||||
endif ()
|
||||
|
||||
if (USE_PAM)
|
||||
target_compile_options(lmsauth PRIVATE "-DLMS_SUPPORT_PAM")
|
||||
|
||||
Reference in New Issue
Block a user