From a7d5a517781ceabb8479ca43cf9dc8f097194fa9 Mon Sep 17 00:00:00 2001 From: soul-walker <31162815+soul-walker@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=20=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yml | 42 ++++++++++++++++++++++++++++++++++++++ Dockerfile | 9 ++++++++ README.md | 2 ++ 3 files changed, 53 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..fcd2880 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,42 @@ +name: build + +on: + push: + branches: + - master + +jobs: + build-rust: + runs-on: walker-local + steps: + - name: 检出代码 + uses: https://gitea.joylink.club/actions/checkout@v4 + with: + submodules: recursive + - name: 设置 Docker + uses: https://gitea.joylink.club/actions/local-setup-docker-cli-action@v0.1.1 + - name: 设置 Docker Buildx + uses: https://gitea.joylink.club/actions/local-setup-buildx-action@v0.1.3 + - name: docker登录gitea.joylink.club + uses: https://gitea.joylink.club/docker/login-action@v3 + with: + registry: gitea.joylink.club + username: shengxuqiang + password: ${{ secrets.SHENGXUQIANG_PASSWORD }} + - name: Docker Build and push + uses: https://gitea.joylink.club/docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: | + gitea.joylink.club/act/rust:bullseye + - name: 本地测试环境pull + uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.LOCAL_233_SSH_HOST }} + port: ${{ secrets.LOCAL_233_SSH_PORT }} + username: ${{ secrets.LOCAL_233_SSH_USER }} + password: ${{ secrets.LOCAL_233_SSH_PASSWORD }} + script: | + docker pull gitea.joylink.club/act/rust:bullseye \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8576f3a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +# 以 node:16-bullseye 镜像为基础,添加openssl、musl-tools、Rust 工具链等工具 +# 用于构建 Rust 项目的镜像 +FROM node:16-bullseye + +RUN apt-get update && apt-get install -y openssl musl-tools && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add x86_64-unknown-linux-musl + +CMD [ "bash" ] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..00556af --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +## 简介 +用于Rust项目构建的Gitea actions使用的docker镜像 \ No newline at end of file