ci: give up build-push-action
Some checks are pending
build-docker-images-for-latest-release / build-and-push (push) Waiting to run
Some checks are pending
build-docker-images-for-latest-release / build-and-push (push) Waiting to run
This commit is contained in:
parent
6c4dbe59e3
commit
46b2c66a60
93
.gitea/workflows/github.yaml
Normal file
93
.gitea/workflows/github.yaml
Normal file
@ -0,0 +1,93 @@
|
||||
name: build-docker-images-for-latest-release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# # Cache Docker layers
|
||||
# - name: Cache Docker image layers
|
||||
# uses: http://fly6516.synology.me:4000/Gitea_Action/cache@v3
|
||||
# with:
|
||||
# path: /tmp/.buildkit-cache
|
||||
# key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-docker-
|
||||
|
||||
# Checkout the repository
|
||||
- name: Checkout repository
|
||||
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2
|
||||
|
||||
# pre pull image
|
||||
- name: Pre Pull Image if Needed
|
||||
run: |
|
||||
IMAGE_NAME="dockerp.com/moby/buildkit:buildx-stable-1"
|
||||
if ! docker image inspect "$IMAGE_NAME" > /dev/null 2>&1; then
|
||||
echo "Image does not exist locally. Pulling..."
|
||||
docker pull "$IMAGE_NAME"
|
||||
else
|
||||
echo "Image already exists locally."
|
||||
fi
|
||||
|
||||
# Create Docker configuration directory
|
||||
- name: Create Docker configuration directory
|
||||
run: sudo mkdir -p /etc/docker
|
||||
|
||||
# # Configure Docker to use dockerp.com as a mirror
|
||||
# - name: Configure Docker Daemon for Mirror
|
||||
# run: |
|
||||
# echo '{
|
||||
# "registry-mirrors": ["https://dockerp.com"]
|
||||
# }' | sudo tee /etc/docker/daemon.json
|
||||
#
|
||||
# # Restart Docker Daemon Without systemd
|
||||
# - name: Restart Docker Daemon
|
||||
# run: |
|
||||
# sudo chmod 644 /etc/docker/daemon.json
|
||||
# sudo pkill -f dockerd || true
|
||||
# sudo pkill -f docker || true
|
||||
# sudo nohup dockerd > /dev/null 2>&1 &
|
||||
# sudo nohup docker > /dev/null 2>&1 &
|
||||
# sleep 5
|
||||
#
|
||||
# # Validate Docker Configuration
|
||||
# - name: Validate Docker Configuration
|
||||
# run: |
|
||||
# cat /etc/docker/daemon.json
|
||||
# docker info | grep -i "Registry Mirrors"
|
||||
|
||||
# Set up Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: http://fly6516.synology.me:4000/docker/setup-buildx-action@v2
|
||||
|
||||
# Log in to Gitea Docker Registry
|
||||
- name: Log in to Gitea Docker Registry
|
||||
uses: http://fly6516.synology.me:4000/docker/login-action@v2
|
||||
with:
|
||||
registry: https://fly6516.synology.me:8080
|
||||
username: ${{ secrets.DOCKER_SYN_USER }}
|
||||
password: ${{ secrets.DOCKER_SYN_PWD }}
|
||||
|
||||
- name: Set Docker Timeout
|
||||
run: |
|
||||
echo "DOCKER_CLIENT_TIMEOUT=300" >> $GITHUB_ENV
|
||||
echo "DOCKER_BUILD_TIMEOUT=300" >> $GITHUB_ENV
|
||||
|
||||
# Build and push the Docker image
|
||||
- name: Build and Push Docker Image
|
||||
uses: http://fly6516.synology.me:4000/docker/build-push-action@v4
|
||||
with:
|
||||
push: true
|
||||
tags: fly6516.synology.me:8080/multilang:latest
|
||||
context: .
|
||||
|
||||
# Optional: Verify the pushed image
|
||||
- name: Verify Docker Image
|
||||
run: |
|
||||
docker pull fly6516.synology.me:8080/multilang:latest
|
||||
docker run --rm fly6516.synology.me:8080/multilang:latest bash -c "echo 'Image verified'"
|
@ -10,81 +10,45 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# # Cache Docker layers
|
||||
# - name: Cache Docker image layers
|
||||
# uses: http://fly6516.synology.me:4000/Gitea_Action/cache@v3
|
||||
# with:
|
||||
# path: /tmp/.buildkit-cache
|
||||
# key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-docker-
|
||||
|
||||
# Checkout the repository
|
||||
- name: Checkout repository
|
||||
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2
|
||||
|
||||
# pre pull image
|
||||
# Pre-pull image if needed
|
||||
- name: Pre Pull Image if Needed
|
||||
run: |
|
||||
IMAGE_NAME="dockerp.com/moby/buildkit:buildx-stable-1"
|
||||
if ! docker image inspect "$IMAGE_NAME" > /dev/null 2>&1; then
|
||||
echo "Image does not exist locally. Pulling..."
|
||||
docker pull "$IMAGE_NAME"
|
||||
else
|
||||
echo "Image already exists locally."
|
||||
fi
|
||||
|
||||
# Create Docker configuration directory
|
||||
- name: Create Docker configuration directory
|
||||
run: sudo mkdir -p /etc/docker
|
||||
|
||||
# # Configure Docker to use dockerp.com as a mirror
|
||||
# - name: Configure Docker Daemon for Mirror
|
||||
# run: |
|
||||
# echo '{
|
||||
# "registry-mirrors": ["https://dockerp.com"]
|
||||
# }' | sudo tee /etc/docker/daemon.json
|
||||
#
|
||||
# # Restart Docker Daemon Without systemd
|
||||
# - name: Restart Docker Daemon
|
||||
# run: |
|
||||
# sudo chmod 644 /etc/docker/daemon.json
|
||||
# sudo pkill -f dockerd || true
|
||||
# sudo pkill -f docker || true
|
||||
# sudo nohup dockerd > /dev/null 2>&1 &
|
||||
# sudo nohup docker > /dev/null 2>&1 &
|
||||
# sleep 5
|
||||
#
|
||||
# # Validate Docker Configuration
|
||||
# - name: Validate Docker Configuration
|
||||
# run: |
|
||||
# cat /etc/docker/daemon.json
|
||||
# docker info | grep -i "Registry Mirrors"
|
||||
IMAGE_NAME="dockerp.com/moby/buildkit:buildx-stable-1"
|
||||
if ! docker image inspect "$IMAGE_NAME" > /dev/null 2>&1; then
|
||||
echo "Image does not exist locally. Pulling..."
|
||||
docker pull "$IMAGE_NAME"
|
||||
else
|
||||
echo "Image already exists locally."
|
||||
fi
|
||||
|
||||
# Set up Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: http://fly6516.synology.me:4000/docker/setup-buildx-action@v2
|
||||
run: |
|
||||
docker buildx create --use --name mybuilder
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
# Log in to Gitea Docker Registry
|
||||
- name: Log in to Gitea Docker Registry
|
||||
uses: http://fly6516.synology.me:4000/docker/login-action@v2
|
||||
with:
|
||||
registry: https://fly6516.synology.me:8080
|
||||
username: ${{ secrets.DOCKER_SYN_USER }}
|
||||
password: ${{ secrets.DOCKER_SYN_PWD }}
|
||||
run: |
|
||||
echo ${{ secrets.DOCKER_SYN_PWD }} | docker login https://fly6516.synology.me:8080 -u ${{ secrets.DOCKER_SYN_USER }} --password-stdin
|
||||
|
||||
# Set Docker Timeout
|
||||
- name: Set Docker Timeout
|
||||
run: |
|
||||
echo "DOCKER_CLIENT_TIMEOUT=300" >> $GITHUB_ENV
|
||||
echo "DOCKER_BUILD_TIMEOUT=300" >> $GITHUB_ENV
|
||||
|
||||
# Build and push the Docker image
|
||||
- name: Build and Push Docker Image
|
||||
uses: http://fly6516.synology.me:4000/docker/build-push-action@v4
|
||||
with:
|
||||
push: true
|
||||
tags: fly6516.synology.me:8080/multilang:latest
|
||||
context: .
|
||||
# Build the Docker image for all architectures
|
||||
- name: Build Multi-Arch Docker Image
|
||||
run: |
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x,linux/386 \
|
||||
-t fly6516.synology.me:8080/multilang:latest \
|
||||
. --push
|
||||
|
||||
# Optional: Verify the pushed image
|
||||
- name: Verify Docker Image
|
||||
|
Loading…
Reference in New Issue
Block a user