diff --git a/.forgejo/workflows/build-on-commit_v4.yml b/.forgejo/workflows/build-on-commit_v4.yml deleted file mode 100644 index c0e3365..0000000 --- a/.forgejo/workflows/build-on-commit_v4.yml +++ /dev/null @@ -1,47 +0,0 @@ -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 ae191a9..1e7213f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,15 @@ -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 wget +RUN apk add --no-cache wine wget -COPY --from=builder /WinBox /WinBox +# Pre-download Winbox +RUN wget -O /winbox64.exe https://download.mikrotik.com/routeros/winbox/3.42/winbox64.exe -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/* +# 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 COPY ./entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh \ No newline at end of file +RUN chmod +x /entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index 01453ae..59aaafc 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,19 @@ #!/bin/bash -/WinBox \ No newline at end of file +# 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 + +while true; do + echo "Starting Winbox..." + wine64 /winbox64.exe + echo "Winbox closed. Restarting in 3 seconds..." + sleep 3 +done \ No newline at end of file