nili 1 năm trước cách đây
mục cha
commit
4daa440423
5 tập tin đã thay đổi với 62 bổ sung6 xóa
  1. 8 0
      .dockerignore
  2. 1 2
      .gitignore
  3. 40 0
      .gitlab-ci.yml
  4. 9 4
      runner.sh
  5. 4 0
      ztncui.sh

+ 8 - 0
.dockerignore

@@ -0,0 +1,8 @@
+.dockerignore
+.git
+.gitignore
+Dockerfile
+.gitlab-ci.yml
+LICENSE
+README.md
+README-EN.md

+ 1 - 2
.gitignore

@@ -1,2 +1 @@
-
-.DS_Store
+*/.DS_Store

+ 40 - 0
.gitlab-ci.yml

@@ -0,0 +1,40 @@
+# https://docs.gitlab.com/ee/ci/yaml/
+# https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
+# https://docs.gitlab.com/ee/ci/migration/github_actions.html
+# https://gitlab.com/gitlab-org/gitlab/-/tree/master/lib/gitlab/ci/templates/Jobs
+
+stages:
+  - build
+
+variables:
+  PUB_DOCKER_USER: "niliaerith"
+  PUB_DOCKER_IMAGE_NAME: $PUB_DOCKER_USER/$CI_PROJECT_NAME
+  PRI_DOCKER_USER: "nili"
+  PRI_DOCKER_IMAGE_NAME: $PRI_DOCKER_URL/$CI_PROJECT_NAME
+
+构建Docker镜像:
+  stage: build
+  # Use the official docker image.
+  tags:
+    - gxy
+  image: docker:dind
+  #image: docker:latest
+  #image: docker:cli
+  #services:
+  #  - name: docker:dind
+  #    command: ["--registry-mirror=https://dhcr-cf.niliovo.top"]
+  before_script:
+    - docker run --privileged --rm tonistiigi/binfmt --install all
+    - docker buildx create --use --name mybuilder
+    - docker login -u "$PRI_DOCKER_USER" -p "$DOCKER_PASSWORD" $PRI_DOCKER_URL
+    - TIME=$(TZ='UTC-8' date +'%Y%m%d-%H-%M-%S')
+  # All branches are tagged with $DOCKER_IMAGE_NAME (defaults to commit ref slug)
+  # Default branch is also tagged with `latest`
+  script:
+    - docker buildx build --file Dockerfile --progress=plain --tag "$PRI_DOCKER_IMAGE_NAME:latest" --tag "$PRI_DOCKER_IMAGE_NAME:$TIME" --platform linux/amd64,linux/arm64 --push .
+    #linux/amd64,linux/arm64,linux/386,linux/arm/v7
+  # Run this job in a branch where a Dockerfile exists
+  rules:
+    - if: $CI_COMMIT_BRANCH
+      exists:
+        - Dockerfile

+ 9 - 4
runner.sh

@@ -1,12 +1,17 @@
 #!/bin/bash
+#sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
 apt update -y
-apt install curl gnupg2 ca-certificates gzip xz-utils iproute2 unzip net-tools procps --no-install-recommends -y
-#Ver=$(wget -qO- -t1 -T2 https://api.github.com/repos/just-containers/s6-overlay/releases/latest | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
+apt install curl gnupg2 ca-certificates gzip xz-utils iproute2 unzip net-tools procps wget --no-install-recommends -y
+Ver=$(wget -qO- -t1 -T2 https://api.github.com/repos/just-containers/s6-overlay/releases/latest | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
+
+wget https://github.com/just-containers/s6-overlay/releases/download/$Ver/s6-overlay-noarch.tar.xz
 #curl -L -O https://github.com/just-containers/s6-overlay/releases/download/$Ver/s6-overlay-noarch.tar.xz
-curl -L -O https://github.com/just-containers/s6-overlay/releases/download/v3.1.6.2/s6-overlay-noarch.tar.xz
+#curl -L -O https://github.com/just-containers/s6-overlay/releases/download/v3.1.6.2/s6-overlay-noarch.tar.xz
 tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && rm /tmp/s6-overlay-noarch.tar.xz
+
+wget https://github.com/just-containers/s6-overlay/releases/download/$Ver/s6-overlay-$(uname -m).tar.xz
 #curl -L -O https://github.com/just-containers/s6-overlay/releases/download/$Ver/s6-overlay-$(uname -m).tar.xz
-curl -L -O https://github.com/just-containers/s6-overlay/releases/download/v3.1.6.2/s6-overlay-$(uname -m).tar.xz
+#curl -L -O https://github.com/just-containers/s6-overlay/releases/download/v3.1.6.2/s6-overlay-$(uname -m).tar.xz
 tar -C / -Jxpf /tmp/s6-overlay-$(uname -m).tar.xz && rm /tmp/s6-overlay-$(uname -m).tar.xz
 groupadd -g 2222 zerotier-one
 useradd -u 2222 -g 2222 zerotier-one

+ 4 - 0
ztncui.sh

@@ -1,14 +1,18 @@
 #!/bin/bash
+#sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
 apt update -y
 apt install curl gnupg2 ca-certificates zip unzip build-essential git --no-install-recommends -y
+
 curl -sL -o node_inst.sh https://deb.nodesource.com/setup_${NODEJS_MAJOR}.x
 bash node_inst.sh
 apt install -y nodejs --no-install-recommends
 rm -f node_inst.sh
+
 git clone https://github.com/kmahyyg/ztncui-aio.git tmp
 mv tmp/* /build
 npm config set registry https://registry.npmmirror.com
 #npm config set registry http://registry.npm.taobao.org
+
 sed -i "s|git clone https://github.com/key-networks/ztncui||g" build-ztncui.sh
 
 sed -i "s|Debugging: Print EnvVar:|Debugging: 输出环境变量:|g" start_firsttime_init.sh

粤ICP备19079148号