由于开放麒麟官方仅提供了riscV架构的镜像又迟迟不公开2.0的标准根文件系统 所以这里只能根据八个月前麒麟相关项目仓库进行修改 (官方人员要是能看见的话给一个2.0的rootfs吧 就当行善积德了)
某些版主要是不懂技术就不要把这个帖子移动到灌水区 这真的需要技术
github工作流内容如下
name: Publish Docker Image
on:
push:
tags:
- 'v*'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: git
run: |
git clone https://gitee.com/openkylin/openkylin-docker.git yangtze
cp Dockerfile yangtze/Dockerfile
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: zhangyiming748/yangtze
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: |
linux/amd64
# linux/arm64
由于原始代码给的方案会造成无密码 也无法更改密码 这里做了一些修改
# 基于空镜像scratch
FROM scratch
LABEL maintainer="zen <zhangyiming748@gmail.com>"
LABEL version="1.0"
LABEL description="This is a custom image based on scratch"
# 添加rootfs文件到镜像中
ADD ./yangtze/yangtze-rootfs.tar.gz /
# 安装curl和vim
# RUN apt-get update && apt-get install -y curl vim git neofetch
# 创建一个用户
RUN adduser zen && echo "zen:123456" | chpasswd
# 用户加入到sudo
RUN adduser zen sudo
# 切换到用户目录
WORKDIR /home/zen
# 设置容器启动时的默认命令,并切换到xxx
USER zen
CMD ["/bin/bash"]