Skip to content

chore: update readme #11

chore: update readme

chore: update readme #11

name: "Nextcloud: Build & Publish Docker Image"
on:
push:
branches:
- main
paths:
- 'nextcloud/**'
- '.github/workflows/build-nextcloud.yml'
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
IMAGE_NAME: "nextcloud"
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up QEMU for multi-architecture build
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
with:
install: true
- name: Log in to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract NEXTCLOUD_VERSION from Dockerfile
id: vars
run: |
NEXTCLOUD_VERSION=$(grep -E '^ARG NEXTCLOUD_VERSION=' nextcloud/Dockerfile | cut -d '=' -f 2 | tr -d '"')
echo "NEXTCLOUD_VERSION=$NEXTCLOUD_VERSION" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
with:
context: nextcloud
platforms: "linux/386,linux/amd64,linux/arm64,linux/arm/v7"
push: true
tags: |
ghcr.io/erhardtconsulting/${{ env.IMAGE_NAME }}:${{ env.NEXTCLOUD_VERSION }}
ghcr.io/erhardtconsulting/${{ env.IMAGE_NAME }}:latest
docker.io/erhardtconsulting/${{ env.IMAGE_NAME }}:${{ env.NEXTCLOUD_VERSION }}
docker.io/erhardtconsulting/${{ env.IMAGE_NAME }}:latest
- name: Log in to Docker Hub (as rootlogin)
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: docker.io
username: rootlogin
password: ${{ secrets.DOCKERHUB_ROOTLOGIN_TOKEN }}
- name: Push image to Docker Hub (as rootlogin)
run: |
docker buildx imagetools create \
--tag ghcr.io/erhardtconsulting/${{ env.IMAGE_NAME }}:${{ env.NEXTCLOUD_VERSION }} \
--tag ghcr.io/erhardtconsulting/${{ env.IMAGE_NAME }}:latest \
--tag docker.io/erhardtconsulting/${{ env.IMAGE_NAME }}:${{ env.NEXTCLOUD_VERSION }} \
--tag docker.io/erhardtconsulting/${{ env.IMAGE_NAME }}:latest \
docker.io/rootlogin/${{ env.IMAGE_NAME }}:${{ env.NEXTCLOUD_VERSION }} \
docker.io/rootlogin/${{ env.IMAGE_NAME }}:latest