This commit is contained in:
AaronHux 2024-05-25 00:37:05 +08:00
parent add36cc33b
commit 118e04da3b
1 changed files with 36 additions and 35 deletions

View File

@ -5,51 +5,52 @@ on: [push]
jobs: jobs:
Explore-Gitea-Actions: Explore-Gitea-Actions:
runs-on: server runs-on: server
container: container: catthehacker/ubuntu:act-latest
image: ghcr.nju.edu.cn/catthehacker/ubuntu:act-latest # container:
# image: ghcr.nju.edu.cn/catthehacker/ubuntu:act-latest
# volumes: # volumes:
# - /run/docker.sock:/run/docker.sock # - /run/docker.sock:/run/docker.sock
env: # env:
DOCKER_ORG: gitea # DOCKER_ORG: gitea
DOCKER_LATEST: latest # DOCKER_LATEST: latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # all history for all branches and tags fetch-depth: 0 # all history for all branches and tags
- name: Set up QEMU # - name: Set up QEMU
uses: docker/setup-qemu-action@v3 # uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX # - name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3 # uses: docker/setup-buildx-action@v3
- name: Login to DockerHub # - name: Login to DockerHub
uses: docker/login-action@v3 # uses: docker/login-action@v3
with: # with:
username: ${{ secrets.DOCKER_USERNAME }} # username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} # password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Meta # - name: Get Meta
id: meta # id: meta
run: | # run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT # echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT # echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push # - name: Build and push
uses: docker/build-push-action@v5 # uses: docker/build-push-action@v5
with: # with:
context: . # context: .
file: ./Dockerfile # file: ./Dockerfile
platforms: | # platforms: |
linux/amd64 # linux/amd64
linux/arm64 # linux/arm64
push: true # push: true
tags: | # tags: |
${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} # ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
# - run: docker build -t website-v1:latest "." - run: docker build -t website-v1:latest "."
# - run: docker rm -f website-v1 || true - run: docker rm -f website-v1 || true
# - run: docker run -d -p 19555:80 --restart=unless-stopped --name website-v1 website-v1 - run: docker run -d -p 19555:80 --restart=unless-stopped --name website-v1 website-v1
# - run: docker rmi $(docker images -f "dangling=true" -q) || true - run: docker rmi $(docker images -f "dangling=true" -q) || true
# - run: docker ps - run: docker ps