Build all-in-one images registry #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build all-in-one images registry | |
on: | |
push: | |
branches: [master, express] | |
pull_request: | |
branches: [master] | |
schedule: | |
- cron: "0 16 * * *" | |
env: | |
IMAGE_REPO: "kubespheredev" | |
IMAGE_NAME: "images-registry" | |
IMAGE_TAG: "latest" | |
SKOPEO_VERSION: v1.2.0 | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Extend free disk | |
run: | | |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android | |
- name: Run docker registry | |
run: | | |
sudo docker run -d --name registry -v /var/lib/registry:/var/lib/registry -p 127.0.0.1:80:5000 registry:2 | |
- name: Sync all images | |
shell: bash | |
run: | | |
bash scripts/sync-images.sh scripts/images-list.txt docker.io localhost | |
- name: Build skopeo binary | |
shell: bash | |
run: | | |
docker build -t skopeo:${SKOPEO_VERSION} -f scripts/build/Dockerfile.skopeo . | |
docker run -d --name skopeo skopeo:${SKOPEO_VERSION} sleep 60s | |
docker cp skopeo:/usr/bin/skopeo . | |
- name: Build images registry | |
shell: bash | |
run: | | |
sudo docker stop registry | |
sudo mv -f /var/lib/registry/docker . | |
sudo docker build -t ${IMAGE_REPO}/${IMAGE_NAME}:${IMAGE_TAG} -f scripts/build/Dockerfile.registry . | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push image | |
run: | | |
docker push ${IMAGE_REPO}/${IMAGE_NAME}:${IMAGE_TAG} |