From be9113d41a8a9780b8c4ce41a680e5c072f20b8f Mon Sep 17 00:00:00 2001 From: "Godwin peter .O" Date: Fri, 4 Oct 2024 11:04:51 +0100 Subject: [PATCH] attempt 6: docker build fix --- .github/workflows/deploy-containers.yml | 70 +++++++++++++------------ docker/Dockerfile.alpine | 1 - docker/Dockerfile.debian | 1 - docker/Dockerfile.ubuntu | 1 - 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/.github/workflows/deploy-containers.yml b/.github/workflows/deploy-containers.yml index 9632719b5d1..2976cd8a4c8 100644 --- a/.github/workflows/deploy-containers.yml +++ b/.github/workflows/deploy-containers.yml @@ -23,7 +23,8 @@ jobs: strategy: fail-fast: false matrix: - os: [alpine, debian, ubuntu] + # os: [alpine, debian, ubuntu] + os: [alpine] steps: - uses: actions/checkout@v4 @@ -31,6 +32,33 @@ jobs: fetch-depth: 0 submodules: true + ## SET VERSION &IMAGES VARIABLES + - name: Set environment VERSION & DOCKERHUB_IMAGE_TAGS + run: | + _TAG="${{ github.ref_name }}" + _VERSION=${_TAG#v*} + _MAJOR_VERSION=${_VERSION%.*} + _DOCKERHUB_IMAGE_TAGS="$DOCKERHUB_REPOSITORY:$_VERSION-${{ matrix.os }}" + _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION-${{ matrix.os }}" + _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:${{ matrix.os }}" + if [ "${{ matrix.os }}" == "alpine" ]; then + _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_VERSION" + _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION" + _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:latest" + fi + echo "VERSION=$_VERSION" >> $GITHUB_ENV + echo "DOCKERHUB_IMAGE_TAGS=$_DOCKERHUB_IMAGE_TAGS" >> $GITHUB_ENV + + - name: Set environment DOCKERHUB_IMAGE_PLATFORMS + run: | + _DOCKERHUB_IMAGE_PLATFORMS="linux/amd64" + if [ "${{ matrix.os }}" == "debian" ]; then + _DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm64" + elif [ "${{ matrix.os }}" == "ubuntu" ]; then + _DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm64" + fi + echo "DOCKERHUB_IMAGE_PLATFORMS=$_DOCKERHUB_IMAGE_PLATFORMS" >> $GITHUB_ENV + ## BUILD PROJECT - run: git checkout ${{ github.ref_name }} working-directory: ./traccar-web @@ -55,11 +83,12 @@ jobs: - name: Build installers working-directory: ./setup run: | - wget -q http://files.jrsoftware.org/is/5/isetup-5.5.6.exe - wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_x64_windows_hotspot_21.0.4_7.zip - wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_x64_linux_hotspot_21.0.4_7.tar.gz - wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.4_7.tar.gz - ./package.sh ${{ github.event.inputs.version }} other + # wget -q http://files.jrsoftware.org/is/5/isetup-5.5.6.exe + # wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_x64_windows_hotspot_21.0.4_7.zip + # wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_x64_linux_hotspot_21.0.4_7.tar.gz + # wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.4_7.tar.gz + ./package.sh ${{ env.VERSION }} other + ls -lsh ## DEPLOY IMAGES - name: Set up QEMU @@ -75,34 +104,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Set environment VERSION & DOCKERHUB_IMAGE_TAGS - run: | - _TAG="${{ github.ref_name }}" - _VERSION=${_TAG#v*} - _MAJOR_VERSION=${_VERSION%.*} - - echo "VERSION=$_VERSION" >> $GITHUB_ENV - echo "MAJOR_VERSION=$_MAJOR_VERSION" >> $GITHUB_ENV - - _DOCKERHUB_IMAGE_TAGS="$DOCKERHUB_REPOSITORY:$_VERSION-${{ matrix.os }}" - _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION-${{ matrix.os }}" - _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:${{ matrix.os }}" - if [ "${{ matrix.os }}" == "alpine" ]; then - _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_VERSION" - _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION" - _DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:latest" - fi - echo "DOCKERHUB_IMAGE_TAGS=$_DOCKERHUB_IMAGE_TAGS" >> $GITHUB_ENV - - - name: Set environment DOCKERHUB_IMAGE_PLATFORMS - run: | - _DOCKERHUB_IMAGE_PLATFORMS="linux/amd64" - if [ "${{ matrix.os }}" == "debian" ]; then - _DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm64" - elif [ "${{ matrix.os }}" == "ubuntu" ]; then - _DOCKERHUB_IMAGE_PLATFORMS+=",linux/arm64" - fi - echo "DOCKERHUB_IMAGE_PLATFORMS=$_DOCKERHUB_IMAGE_PLATFORMS" >> $GITHUB_ENV + - name: Build and push if: env.DOCKERHUB_IMAGE_TAGS != '' uses: docker/build-push-action@v4 diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index ce294f92d01..8f5e123497f 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -1,7 +1,6 @@ FROM alpine:3 LABEL maintainer="Godwin peter .O " ARG TRACCAR_VERSION=6.5 -ENV TRACCAR_VERSION=${TRACCAR_VERSION} WORKDIR /opt/traccar RUN set -ex && \ diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 4abc110b7ea..5f4e40793ef 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -1,7 +1,6 @@ FROM debian:bookworm-slim LABEL maintainer="Godwin peter .O " ARG TRACCAR_VERSION=6.5 -ENV TRACCAR_VERSION=${TRACCAR_VERSION} WORKDIR /opt/traccar RUN set -ex && \ diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index 4be0076eeea..67c5e85fb8c 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -1,7 +1,6 @@ FROM sapmachine:17-jre-headless-ubuntu-jammy LABEL maintainer="Godwin peter .O " ARG TRACCAR_VERSION=6.5 -ENV TRACCAR_VERSION=${TRACCAR_VERSION} WORKDIR /opt/traccar RUN set -ex && \