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
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
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
|
# Checkout the repository
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2
|
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2
|
||||||
|
|
||||||
# pre pull image
|
# Pre-pull image if needed
|
||||||
- name: Pre Pull Image if Needed
|
- name: Pre Pull Image if Needed
|
||||||
run: |
|
run: |
|
||||||
IMAGE_NAME="dockerp.com/moby/buildkit:buildx-stable-1"
|
IMAGE_NAME="dockerp.com/moby/buildkit:buildx-stable-1"
|
||||||
if ! docker image inspect "$IMAGE_NAME" > /dev/null 2>&1; then
|
if ! docker image inspect "$IMAGE_NAME" > /dev/null 2>&1; then
|
||||||
echo "Image does not exist locally. Pulling..."
|
echo "Image does not exist locally. Pulling..."
|
||||||
docker pull "$IMAGE_NAME"
|
docker pull "$IMAGE_NAME"
|
||||||
else
|
else
|
||||||
echo "Image already exists locally."
|
echo "Image already exists locally."
|
||||||
fi
|
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
|
# Set up Docker Buildx
|
||||||
- name: 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
|
# Log in to Gitea Docker Registry
|
||||||
- name: Log in to Gitea Docker Registry
|
- name: Log in to Gitea Docker Registry
|
||||||
uses: http://fly6516.synology.me:4000/docker/login-action@v2
|
run: |
|
||||||
with:
|
echo ${{ secrets.DOCKER_SYN_PWD }} | docker login https://fly6516.synology.me:8080 -u ${{ secrets.DOCKER_SYN_USER }} --password-stdin
|
||||||
registry: https://fly6516.synology.me:8080
|
|
||||||
username: ${{ secrets.DOCKER_SYN_USER }}
|
|
||||||
password: ${{ secrets.DOCKER_SYN_PWD }}
|
|
||||||
|
|
||||||
|
# Set Docker Timeout
|
||||||
- name: Set Docker Timeout
|
- name: Set Docker Timeout
|
||||||
run: |
|
run: |
|
||||||
echo "DOCKER_CLIENT_TIMEOUT=300" >> $GITHUB_ENV
|
echo "DOCKER_CLIENT_TIMEOUT=300" >> $GITHUB_ENV
|
||||||
echo "DOCKER_BUILD_TIMEOUT=300" >> $GITHUB_ENV
|
echo "DOCKER_BUILD_TIMEOUT=300" >> $GITHUB_ENV
|
||||||
|
|
||||||
# Build and push the Docker image
|
# Build the Docker image for all architectures
|
||||||
- name: Build and Push Docker Image
|
- name: Build Multi-Arch Docker Image
|
||||||
uses: http://fly6516.synology.me:4000/docker/build-push-action@v4
|
run: |
|
||||||
with:
|
docker buildx build \
|
||||||
push: true
|
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x,linux/386 \
|
||||||
tags: fly6516.synology.me:8080/multilang:latest
|
-t fly6516.synology.me:8080/multilang:latest \
|
||||||
context: .
|
. --push
|
||||||
|
|
||||||
# Optional: Verify the pushed image
|
# Optional: Verify the pushed image
|
||||||
- name: Verify Docker Image
|
- name: Verify Docker Image
|
||||||
|
Loading…
Reference in New Issue
Block a user