Skip to content

Commit

Permalink
Dockerのジョブを分けた
Browse files Browse the repository at this point in the history
  • Loading branch information
yuito-it committed Aug 1, 2024
1 parent 3d081a6 commit 01ecded
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- main

jobs:
build-and-push:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -14,7 +14,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: enable
- name: Enable Docker configuration
run: |
SW_JSON=""
SW_JSON="$(sudo cat /etc/docker/daemon.json | jq '.+{ "insecure-registries":["${{ secrets.K8S_DOCKER_REGISTHOST }}"],"max-concurrent-uploads": 1,"debug":true }')"
Expand All @@ -28,6 +28,7 @@ jobs:
echo ---
sudo systemctl status docker
shell: bash

- name: Check Docker status
run: |
export DOCKER_CLIENT_TIMEOUT=18000
Expand All @@ -37,6 +38,17 @@ jobs:
- name: Build Docker image
run: docker build -t ${{ secrets.K8S_DOCKER_REGISTHOST }}/mediawiki:latest .
id: build

push:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Push Docker image
run: docker push ${{ secrets.K8S_DOCKER_REGISTHOST }}/mediawiki:latest
run: docker push ${{ secrets.K8S_DOCKER_REGISTHOST }}/mediawiki:latest
32 changes: 20 additions & 12 deletions .github/workflows/docker-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ on:
- 'v*'

jobs:
build-and-push:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Extract tag name
run: |
tagname=${GITHUB_REF#refs/*/} && echo "TAG_NAME=${tagname#v}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Set deamon.json
- name: Enable Docker configuration
run: |
SW_JSON=""
SW_JSON="$(sudo cat /etc/docker/daemon.json | jq '.+{ "insecure-registries":["${{ secrets.K8S_DOCKER_REGISTHOST }}"] }')"
"experimental": false
echo "${SW_JSON}" | sudo bash -c 'cat -- > /etc/docker/daemon.json'
SW_JSON="$(sudo cat /etc/docker/daemon.json | jq '.+{ "experimental":false }')"
SW_JSON="$(sudo cat /etc/docker/daemon.json | jq '.+{ "insecure-registries":["${{ secrets.K8S_DOCKER_REGISTHOST }}"],"max-concurrent-uploads": 1,"debug":true }')"
echo "${SW_JSON}" | sudo bash -c 'cat -- > /etc/docker/daemon.json'
sudo cat /etc/docker/daemon.json
sudo systemctl restart docker || sudo journalctl -xeu docker.service
Expand All @@ -36,15 +33,26 @@ jobs:
sudo systemctl status docker
shell: bash

- name: Set Timeout
- name: Check Docker status
run: |
export DOCKER_CLIENT_TIMEOUT=9000
export COMPOSE_HTTP_TIMEOUT=120
export DOCKER_CLIENT_TIMEOUT=18000
export COMPOSE_HTTP_TIMEOUT=240
sudo systemctl status docker.service
sudo journalctl -xeu docker.service
- name: Build Docker image
run: docker build -t ${{ secrets.K8S_DOCKER_REGISTHOST }}/mediawiki:${{ env.TAG_NAME }} .
id: build

push:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Push Docker image
run: docker push ${{ secrets.K8S_DOCKER_REGISTHOST }}/mediawiki:${{ env.TAG_NAME }}

0 comments on commit 01ecded

Please sign in to comment.