Initial commit

This commit is contained in:
2025-10-31 01:19:37 -04:00
parent 451fc5e471
commit 051b2b7fcd
2 changed files with 225 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
name: Docker Build (multi-arch AMD64 + ARM64)
on:
workflow_dispatch:
env:
REGISTRY: gitea.cuihang1201.synology.me
IMAGE_NAME: hangpersonal/sad-workspace
TAG_NAME: latest
PLATFORMS: linux/amd64,linux/arm64
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU (for cross-compiling)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# Login to your Gitea registry: provide REGISTRY_USER / REGISTRY_PASSWORD as repo secrets in Gitea
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
# Optional: derive tags/labels from repo metadata; comment out if you prefer static tags only
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ env.TAG_NAME }}
type=raw,value=sha-${{ github.sha }}
flavor: |
latest=false
- name: Build and push (multi-arch)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Optional: print the final manifest list for verification
- name: Inspect pushed manifest
run: |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}

160
Dockerfile Normal file
View File

@@ -0,0 +1,160 @@
# Multi-arch base (Ubuntu 20.04)
FROM ubuntu:20.04
# Make tzdata noninteractive for Docker builds
ENV DEBIAN_FRONTEND=noninteractive
# ---- Time zone (fix echo to expand $TZ) ----
ENV TZ=America/Detroit
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo "$TZ" > /etc/timezone
# ---- Select proper Ubuntu mirror per arch ----
# TARGETARCH is set automatically by docker buildx (e.g., amd64 or arm64)
ARG TARGETARCH
# Rebuild /etc/apt/sources.list with the right base URL and optional [arch=...] tags
# - amd64 -> archive.ubuntu.com
# - arm64 -> ports.ubuntu.com/ubuntu-ports
RUN set -eux; \
if [ "$TARGETARCH" = "arm64" ]; then \
BASE_URL="http://ports.ubuntu.com/ubuntu-ports"; ARCH_TAG="[arch=arm64]"; \
else \
BASE_URL="http://archive.ubuntu.com/ubuntu"; ARCH_TAG="[arch=amd64]"; \
fi; \
cat > /etc/apt/sources.list <<EOF
deb ${ARCH_TAG} ${BASE_URL} focal main restricted universe multiverse
deb ${ARCH_TAG} ${BASE_URL} focal-updates main restricted universe multiverse
deb ${ARCH_TAG} ${BASE_URL} focal-backports main restricted universe multiverse
deb ${ARCH_TAG} ${BASE_URL} focal-security main restricted universe multiverse
EOF
RUN apt-get update
# unminimize ubuntu
RUN yes | unminimize
# config CN environment
RUN apt install language-pack-zh-hans -y
RUN echo LANG="zh_CN.UTF-8" >> /etc/environment
RUN echo LANGUAGE="zh_CN:zh:en_US:en" >> /etc/environment
RUN echo LANG="zh_CN.UTF-8" >> /etc/profile
RUN echo LANGUAGE="zh_CN:zh:en_US:en" >> /etc/profile
RUN echo LANG="zh_CN.UTF-8" >> ~/.bashrc
RUN echo LANGUAGE="zh_CN:zh:en_US:en" >> ~/.bashrc
RUN locale-gen
RUN /bin/bash -c "source ~/.bashrc"
# install xfce4
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get install -y xfce4 xfce4-terminal
RUN apt install dbus-x11 -y
RUN apt install fonts-wqy-microhei -y
RUN apt install -y \
gnome-user-docs-zh-hans \
language-pack-gnome-zh-hans \
fcitx \
fcitx-pinyin \
fcitx-table-wubi \
vim \
less \
ca-certificates
# install ROS
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-get install curl -y
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
RUN apt-get update
RUN apt install ros-noetic-desktop-full -y
RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"
# install SAD dependence
RUN apt-get install -y \
ros-noetic-pcl-ros \
ros-noetic-velodyne-msgs \
libopencv-dev \
libgoogle-glog-dev \
libeigen3-dev \
libsuitesparse-dev \
libpcl-dev\
libyaml-cpp-dev \
libbtbb-dev \
libgmock-dev \
pcl-tools \
libspdlog-dev \
libqglviewer-dev-qt5 \
git
# Add build + Pangolin deps (incl. epoxy)
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gcc-11 g++-11 \
build-essential cmake git pkg-config \
libeigen3-dev \
libjpeg-turbo8-dev libpng-dev libtiff-dev libopenexr-dev \
liblz4-dev libzstd-dev \
libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev \
libxkbcommon-dev libwayland-dev wayland-protocols \
libepoxy-dev
WORKDIR /root/software
# Clone Pangolin repository and checkout v0.9.4
# Hang add git checkout v0.9.4
#RUN git clone https://github.com/stevenlovegrove/Pangolin.git && \
# cd Pangolin && \
# git checkout v0.9.4 && \
# mkdir build && \
# cd build && \
# cmake .. && \
# make -j8 && \
# make install && \
# ldconfig
# Build with GCC 11, and still sidestep EXR
RUN git clone https://github.com/stevenlovegrove/Pangolin.git && \
cd Pangolin && \
git checkout v0.9.4 && \
mkdir -p build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 \
-DCMAKE_DISABLE_FIND_PACKAGE_OpenEXR=ON \
# -DBUILD_EXAMPLES=OFF -DBUILD_TOOLS=OFF \
.. && \
make -j"$(nproc)" && \
make install && \
ldconfig
# set up vnc
RUN apt-get install tigervnc-standalone-server x11vnc -y
WORKDIR /root/.vnc
COPY ./docker/xstartup ./
RUN chmod u+x ~/.vnc/xstartup
# set up noVNC
WORKDIR /usr/lib
RUN git clone https://github.com/novnc/noVNC.git -o noVNC
WORKDIR /usr/lib/noVNC/utils
RUN git clone https://github.com/novnc/websockify.git -o websockify
WORKDIR /
COPY ./docker/startup.sh ./
RUN chmod u+x startup.sh
ENTRYPOINT ["./startup.sh"]
# ENTRYPOINT ["tail","-f","/dev/null"]