diff --git a/.forgejo/workflows/build-on-commit_v4.yml b/.forgejo/workflows/build-on-commit_v4.yml new file mode 100644 index 0000000..c0e3365 --- /dev/null +++ b/.forgejo/workflows/build-on-commit_v4.yml @@ -0,0 +1,47 @@ +name: Build Docker Image on Commit v4 + +on: + push: + branches: + - winbox4 + tags: + - '!' # Exclude tags + +jobs: + build-and-publish: + runs-on: docker-builder + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set REPO_VARS + id: repo-url + run: | + echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV + echo "REPO_PATH=${{ github.repository }}" >> $GITHUB_ENV + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + driver-opts: | + network=host + + - name: Login to OCI registry + run: | + echo "${{ secrets.OCI_TOKEN }}" | docker login $REPO_HOST -u "${{ secrets.OCI_USER }}" --password-stdin + + - name: Build and push multi-arch Docker images + run: | + docker buildx build \ + --platform linux/amd64 \ + --tag $REPO_HOST/$REPO_PATH:${{ github.sha }} \ + --tag $REPO_HOST/$REPO_PATH:nightly-v4 \ + --push \ + . + + - name: Cleanup + run: | + docker buildx prune -f + docker logout $REPO_HOST \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 1e7213f..ae191a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,29 @@ +FROM alpine:latest as builder + +RUN apk add --no-cache unzip wget +RUN wget -O /tmp/WinBox_Linux.zip https://download.mikrotik.com/routeros/winbox/4.0beta22/WinBox_Linux.zip && \ + unzip /tmp/WinBox_Linux.zip -d /tmp/winbox && \ + + wget -O /tmp/upx.tar.xz https://github.com/upx/upx/releases/download/v5.0.1/upx-5.0.1-amd64_linux.tar.xz && \ + tar -xf /tmp/upx.tar.xz -C /tmp && \ + mv /tmp/winbox/WinBox /WinBox && \ + /tmp/upx-5.0.1-amd64_linux/upx --lzma /WinBox + FROM git.merith.xyz/gns3/base-vnc:latest -RUN apk add --no-cache wine wget +RUN apk add --no-cache wget -# Pre-download Winbox -RUN wget -O /winbox64.exe https://download.mikrotik.com/routeros/winbox/3.42/winbox64.exe +COPY --from=builder /WinBox /WinBox -# Preload Wine Mono -RUN mkdir -p /usr/share/wine/mono && \ - wget https://dl.winehq.org/wine/wine-mono/9.0.0/wine-mono-9.0.0-x86.msi -O /usr/share/wine/mono/wine-mono.msi && \ - wineboot --init && \ - wine msiexec /i /usr/share/wine/mono/wine-mono.msi /qn +RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-2.35-r1.apk && \ + wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-bin-2.35-r1.apk && \ + wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-i18n-2.35-r1.apk && \ + apk add --allow-untrusted glibc-2.35-r1.apk glibc-bin-2.35-r1.apk glibc-i18n-2.35-r1.apk && \ + /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 && \ + echo "export LANG=en_US.UTF-8" >> /etc/profile.d/glibc.sh && \ + echo "export LC_ALL=en_US.UTF-8" >> /etc/profile.d/glibc.sh && \ + rm glibc-2.35-r1.apk glibc-bin-2.35-r1.apk glibc-i18n-2.35-r1.apk && \ + rm -rf /var/cache/apk/* COPY ./entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 42bfd87..01453ae 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,14 +1,3 @@ #!/bin/bash -# Wait until internet is available -while ! ping -c1 1.1.1.1 &>/dev/null; do - echo "Waiting for internet connection..." - sleep 5 -done - -if [ ! -f "/winbox64.exe" ]; then - echo "Winbox executable not found in /data. Downloading..." - wget -O /winbox64.exe https://download.mikrotik.com/routeros/winbox/3.42/winbox64.exe -fi - -wine64 /winbox64.exe +/WinBox \ No newline at end of file