Skip to content

Commit

Permalink
PZACXX-5 - Docker registry done
Browse files Browse the repository at this point in the history
  • Loading branch information
wardru committed Oct 4, 2023
1 parent 05619c1 commit 0864374
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 58 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ target_link_libraries(${LIBRARY_NAME}
)

if (CMAKE_SYSTEM_NAME MATCHES "Windows" AND BUILD_SHARED_LIBS)
message(STATUS "Copying DLLs from ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin to ${CMAKE_BINARY_DIR}/bin")
add_custom_command(TARGET ${LIBRARY_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/bin/*.dll
${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin/*.dll
$<TARGET_FILE_DIR:${LIBRARY_NAME}>
)
endif()
Expand Down
12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

29 changes: 0 additions & 29 deletions docker.sh

This file was deleted.

33 changes: 33 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM archlinux:base-devel-20231001.0.182270

RUN echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf
RUN pacman -Syu --noconfirm
RUN pacman -Sy --noconfirm \
git \
ninja \
cmake \
python \
python-pip \
wget \
clang \
libunwind \
wine

RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install conan==1.60
RUN conan profile new default --detect
RUN conan profile update settings.compiler.libcxx=libstdc++11 default

RUN useradd -m mingw && echo "mingw:password" | chpasswd
RUN echo "mingw ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/myuser
USER mingw
WORKDIR /home/mingw
RUN git clone https://aur.archlinux.org/paru.git
RUN cd paru && makepkg -si --noconfirm
RUN paru -S --noconfirm mingw-w64-cmake mingw-w64-zstd mingw-w64-zlib

USER root
RUN ln -s /usr/x86_64-w64-mingw32/lib/librpcrt4.a /usr/x86_64-w64-mingw32/lib/libRpcRT4.a
RUN userdel -r mingw
WORKDIR /
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ foreach(example ${examples})
if (CMAKE_SYSTEM_NAME MATCHES "Windows" AND BUILD_SHARED_LIBS)
add_custom_command(TARGET ${example} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/bin/*.dll
${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin/*.dll
$<TARGET_FILE_DIR:${example}>
)
endif()
Expand Down
12 changes: 0 additions & 12 deletions run.sh

This file was deleted.

4 changes: 1 addition & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ fi

if [ "$LIB_MODE" == "Static" ]; then
BUILD_DIR="${BUILD_DIR}_static"
elif [ "$LIB_MODE" == "Shared" ]; then
continue
else
elif [ "$LIB_MODE" != "Shared" ]; then
echo "Library mode not supported: $LIB_MODE"
exit 1
fi
Expand Down
3 changes: 3 additions & 0 deletions scripts/docker_pull.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker pull ghcr.io/panduza/pzacx-build-img:latest
58 changes: 58 additions & 0 deletions scripts/docker_registry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

IMAGE_NAME="pzacx-build-img"
PROJECT_ROOT_DIR="$(dirname "$(realpath "$0")")/.."

TEMP=$(getopt -o u:p:h --long username:,password:,help -n "$0" -- "$@")
if [ $? != 0 ]; then
echo "Error processing arguments." >&2
exit 1
fi

eval set -- "$TEMP"

while true; do
case "$1" in
-u|--username)
GITHUB_USER="$2"
shift 2
;;
-p|--password)
PASSWORD="$2"
shift 2
;;
-h|--help)
echo "Usage: $0 [-u <username>] [-p <password>] [-h]"
echo " -u --username Github username"
echo " -p --password Github token"
echo " -h --help Display this help message"
exit 0
;;
--)
shift
break
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done

if [ -z "$GITHUB_USER" ]; then
echo "Username not specified"
echo "-h or --help for more information"
exit 1
fi

if [ -z "$PASSWORD" ]; then
echo "Password not specified"
echo "-h or --help for more information"
exit 1
fi


docker login ghcr.io -u $USERNAME -p $PASSWORD || exit 1
docker build -t $IMAGE_NAME $PROJECT_ROOT_DIR/docker || exit 1
docker tag $IMAGE_NAME:latest ghcr.io/panduza/$IMAGE_NAME:latest || exit 1
docker push ghcr.io/panduza/$IMAGE_NAME:latest

0 comments on commit 0864374

Please sign in to comment.