feat(ci/cd): Automatic builds
Some checks failed
Build / build (push) Failing after 1m35s

This commit is contained in:
Jiří Štefka 2024-04-19 05:24:34 +02:00
parent 4f74598419
commit 25d3fd3227
Signed by: jiriks74
GPG Key ID: 1D5E30D3DB2264DE
3 changed files with 33 additions and 30 deletions

@ -1,40 +1,53 @@
name: Build name: Build
on: on:
schedule:
- cron: "0 0 * * 1"
push: push:
tags: tags:
- 'v*' - 'manual_build'
jobs: jobs:
build: build:
runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v2
- name: Extract Version Tag - name: Extract Version Tag
id: extract-version id: extract-version
run: echo "docker_tag=$(grep -oP '(?<=FROM nextcloud:)[0-9]+\.[0-9]+\.[0-9]+' Dockerfile)" >> $GITHUB_OUTPUT
shell: bash
- name: Install Docker
run: | run: |
apt-get update export DIGEST=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=100" | jq -r '.results[] | select(.name=="latest") .digest')
apt-get install docker.io -y export VERSION=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=1000" | jq -r ".results[] | select(.name | test(\"^([0-9]+\\\.)+([0-9]+\\\.)+[0-9]+$\")) | select(.digest==\"$DIGEST\").name")
echo "Latest version: $VERSION"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
shell: bash
- name: Check if the image was already built
id: check-build-status
run: |
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/nextcloud-extended/tags/$(echo ${{steps.extract-version.outputs.version}})" 2> /dev/null; then echo "Built already!" && exit 1; else echo "This version isn't built yet."; fi
- name: Update repositories
run: sudo apt update
- name: Install Docker
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: docker.io
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v3
with: with:
driver-opts: network=host # driver-opts: network=host
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
- name: Checkout
uses: actions/checkout@v4
- name: Build image - name: Build image
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
@ -44,18 +57,3 @@ jobs:
context: . context: .
file: ./Dockerfile file: ./Dockerfile
# - name: Build image
# uses: docker/build-push-action@v2
# with:
# push: true
# tags:
# jiriks74/nextcloud-extended:latest
# platforms: linux/amd64,linux/arm64
# context: .
# file: ./Dockerfile
# - name: Tag latest
# run: |
# docker image ls
# docker tag nextcloud-extended:${{ steps.extract-version.outputs.docker_tag }} nextcloud-extended:latest
# docker push nextcloud-extended:latest

5
.gitignore vendored Normal file

@ -0,0 +1,5 @@
# Direnv
.direnv
# ACT runner
.env

@ -1,4 +1,4 @@
FROM nextcloud:28.0.4 FROM nextcloud:latest
LABEL maintainer="Jiří Štefka <jiri@stefka.eu>" LABEL maintainer="Jiří Štefka <jiri@stefka.eu>"
# RUN apt update && apt upgrade -y --no-install-recommends && apt install ffmpeg aria2 youtube-dl libmagickcore-dev -y --no-install-recommends # RUN apt update && apt upgrade -y --no-install-recommends && apt install ffmpeg aria2 youtube-dl libmagickcore-dev -y --no-install-recommends