generated from gns3/vnc-template
Compare commits
8 commits
Author | SHA1 | Date | |
---|---|---|---|
e372d13ad7 | |||
36e020bdb4 | |||
8752fc725a | |||
bff5d820b3 | |||
b7c8fd0ec9 | |||
5229885c7f | |||
0646385984 | |||
f85ffa6c21 |
3 changed files with 71 additions and 26 deletions
47
.forgejo/workflows/build-on-commit_v4.yml
Normal file
47
.forgejo/workflows/build-on-commit_v4.yml
Normal file
|
@ -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
|
32
Dockerfile
32
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
|
FROM git.merith.xyz/gns3/base-vnc:latest
|
||||||
|
|
||||||
RUN apk add --no-cache wine wget
|
RUN apk add --no-cache wget
|
||||||
|
|
||||||
# Pre-download Winbox
|
COPY --from=builder /WinBox /WinBox
|
||||||
RUN wget -O /winbox64.exe https://download.mikrotik.com/routeros/winbox/3.42/winbox64.exe
|
|
||||||
|
|
||||||
# Preload Wine Mono
|
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-2.35-r1.apk && \
|
||||||
RUN mkdir -p /usr/share/wine/mono && \
|
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-bin-2.35-r1.apk && \
|
||||||
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 && \
|
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r1/glibc-i18n-2.35-r1.apk && \
|
||||||
wineboot --init && \
|
apk add --allow-untrusted glibc-2.35-r1.apk glibc-bin-2.35-r1.apk glibc-i18n-2.35-r1.apk && \
|
||||||
wine msiexec /i /usr/share/wine/mono/wine-mono.msi /qn
|
/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
|
COPY ./entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
|
@ -1,19 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Wait until internet is available
|
/WinBox
|
||||||
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
|
|
Loading…
Reference in a new issue