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