diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..033769f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,30 @@ +image: docker:latest +services: + - docker:dind + +stages: + - build + +variables: + IMAGE: registry.gitlab.com/bockiii/deemix-docker + DOCKER_CLI_EXPERIMENTAL: enabled + ARCH_AMD: python3 + ARCH_ARM32: python3.armhf + ARCH_ARM64: python3.arm64 + +before_script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + +build: + stage: build + script: + - docker build --build-arg IMAGE_ARCH=$ARCH_AMD --pull -t $IMAGE:amd64 . + - docker push $IMAGE:amd64 + - docker build --build-arg IMAGE_ARCH=$ARCH_ARM32 --pull -t $IMAGE:arm32v7 . + - docker push $IMAGE:armhf + - docker build --build-arg IMAGE_ARCH=$ARCH_ARM64 --pull -t $IMAGE:arm64v8 . + - docker push $IMAGE:arm64 + - docker manifest create $IMAGE $IMAGE:amd64 $IMAGE:arm32v7 $IMAGE:arm64v8 + - docker manifest annotate $IMAGE $IMAGE:arm32v7 --os linux --arch arm + - docker manifest annotate $IMAGE $IMAGE:arm64v8 --os linux --arch arm64 + - docker manifest push $IMAGE \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 919fa32..1570b4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM lsiobase/alpine.python3:3.9 +FROM lsiobase/alpine.$IMAGE_ARCH:3.9 ENV PUID=1000 ENV PGID=1000 diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 deleted file mode 100644 index fbd8750..0000000 --- a/Dockerfile.arm32v7 +++ /dev/null @@ -1,36 +0,0 @@ -FROM alpine AS builder - -# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 -#ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz -ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v4.0.0-balena/qemu-4.0.0-balena-arm.tar.gz -RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 - -FROM lsiobase/alpine.python3.armhf:3.9 - -# Add QEMU -COPY --from=builder qemu-arm-static /usr/bin - -ENV PUID=1000 -ENV PGID=1000 - -EXPOSE 9666 - -RUN \ - apk update && \ - apk add --no-cache \ - gcc \ - g++ \ - libffi-dev \ - python3-dev \ - make - -RUN \ - mkdir /deem && \ - chown abc:abc /deem && \ - rm -R /config && \ - ln -sf /deem/.config/deemix /config && \ - ln -sf /downloads /deem/deemix\ Music - -COPY root/ / - -VOLUME /downloads /config \ No newline at end of file diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 deleted file mode 100644 index 28f0b0b..0000000 --- a/Dockerfile.arm64v8 +++ /dev/null @@ -1,36 +0,0 @@ -FROM alpine AS builder - -# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261 -#ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-aarch64.tar.gz -ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v4.0.0-balena/qemu-4.0.0-balena-aarch64.tar.gz -RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1 - -FROM lsiobase/alpine.python3.arm64:3.8 - -# Add QEMU -COPY --from=builder qemu-aarch64-static /usr/bin - -ENV PUID=1000 -ENV PGID=1000 - -EXPOSE 9666 - -RUN \ - apk update && \ - apk add --no-cache \ - gcc \ - g++ \ - libffi-dev \ - python3-dev \ - make - -RUN \ - mkdir /deem && \ - chown abc:abc /deem && \ - rm -R /config && \ - ln -sf /deem/.config/deemix /config && \ - ln -sf /downloads /deem/deemix\ Music - -COPY root/ / - -VOLUME /downloads /config \ No newline at end of file diff --git a/hooks/post_push b/hooks/post_push deleted file mode 100644 index 9ebdc9b..0000000 --- a/hooks/post_push +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Autobuild the Image on Docker Hub with advanced options -# https://docs.docker.com/docker-hub/builds/advanced/ - -# if the host is not equal to the building system architecture, set the image arch with manifest correctly on docker hub. - -set -e - -#IMAGE_OS=$(uname | tr '[:upper:]' '[:lower:]') -IMAGE_OS="linux" -HOST_ARCH=$(uname -m) -HOST_ARCH_ALIAS=$([[ "${HOST_ARCH}" == "x86_64" ]] && echo "amd64" || echo "${HOST_ARCH}") -BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f 2) -BUILD_ARCH=$([[ "${BUILD_ARCH}" == *\/* ]] && echo "${BUILD_ARCH}" | rev | cut -d '/' -f 1 | rev || echo "${BUILD_ARCH}") -QEMU_USER_STATIC_ARCH=$([[ "${BUILD_ARCH}" == "armhf" ]] && echo "${BUILD_ARCH::-2}" || echo "${BUILD_ARCH}") -PLATFORMS_ARCH=$([[ "${QEMU_USER_STATIC_ARCH}" == "arm" ]] && echo "${IMAGE_OS}/${QEMU_USER_STATIC_ARCH},${IMAGE_OS}/${QEMU_USER_STATIC_ARCH}64,${IMAGE_OS}/${HOST_ARCH_ALIAS}" || echo "${IMAGE_OS}/${QEMU_USER_STATIC_ARCH}") - -echo "PLATFORMS-ARCH: ${PLATFORMS_ARCH}" - -if [[ "${HOST_ARCH}" == "${QEMU_USER_STATIC_ARCH}"* || "${BUILD_ARCH}" == "Dockerfile" ]]; then - echo "Building ${BUILD_ARCH} image natively; No manifest needed for current arch." - exit 0 -else - # Manifest - - # docker manifest: https://docs.docker.com/engine/reference/commandline/manifest/ - echo "docker manifest (not working with autobuild on docker hub)" - #docker manifest create "${IMAGE_NAME}" "${IMAGE_NAME}" - #docker manifest annotate "${IMAGE_NAME}" "${IMAGE_NAME}" --os "${IMAGE_OS}" --arch "${QEMU_USER_STATIC_ARCH}" - #docker manifest push "${IMAGE_NAME}" - - # manifest-tool: https://github.com/estesp/manifest-tool - echo "manifest-tool" - # prerelease: - #MANIFEST_TOOL_VERSION=$(curl -s https://api.github.com/repos/estesp/manifest-tool/tags | grep 'name.*v[0-9]' | head -n 1 | cut -d '"' -f 4) - # release: - MANIFEST_TOOL_VERSION=$(curl -s https://api.github.com/repos/estesp/manifest-tool/releases/latest | grep 'tag_name' | cut -d\" -f4) - curl -L https://github.com/estesp/manifest-tool/releases/download/$MANIFEST_TOOL_VERSION/manifest-tool-$IMAGE_OS-$HOST_ARCH_ALIAS -o manifest-tool - chmod +x manifest-tool - #./manifest-tool push from-args --platforms ${PLATFORMS_ARCH} --template ${IMAGE_NAME} --target ${IMAGE_NAME} - ./manifest-tool push from-spec manifest.yaml -fi \ No newline at end of file diff --git a/hooks/pre_build b/hooks/pre_build deleted file mode 100644 index d5a811d..0000000 --- a/hooks/pre_build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# Register qemu-*-static for all supported processors except the -# current one, but also remove all registered binfmt_misc before -docker run --rm --privileged multiarch/qemu-user-static:register --reset \ No newline at end of file diff --git a/manifest.yaml b/manifest.yaml deleted file mode 100644 index 4730399..0000000 --- a/manifest.yaml +++ /dev/null @@ -1,16 +0,0 @@ -image: bocki/deemix:latest -manifests: - - image: bocki/deemix:amd64 - platform: - architecture: amd64 - os: linux - - image: bocki/deemix:arm32v7 - platform: - architecture: arm - os: linux - variant: v7 - - image: bocki/deemix:arm64v8 - platform: - architecture: arm64 - os: linux - variant: v8 \ No newline at end of file