1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-11-20 01:52:32 +01:00
This commit is contained in:
GilbN 2022-04-03 13:33:48 +00:00
parent 068acc4f4a
commit d7969e06cb
4 changed files with 132 additions and 54 deletions

View File

@ -24,18 +24,28 @@ on:
jobs: jobs:
build-and-push-it-to-the-limit: build-and-push-it-to-the-limit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
architecture: [linux-arm-v7,linux-arm64,linux-amd64]
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Get the version - name: Prepare
id: get_version id: prep
run: echo ::set-output name=VERSION::${{ github.event.release.tag_name }} run: |
ARCHITECTURE=${{ matrix.architecture }}
- name: Set current date as env variable echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
id: date_time echo ::set-output name=title::${GITHUB_REPOSITORY,,}:${GITHUB_REF//refs\/heads\//}
run: echo ::set-output name=NOW::$(date +'%Y-%m-%dT%H:%M:%S') echo ::set-output name=revision::${GITHUB_SHA}
echo ::set-output name=source::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY,,}/tree/${GITHUB_REF//refs\/heads\//}
echo ::set-output name=vendor::${{ github.repository_owner }}
echo ::set-output name=url::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY,,}/blob/master/README.md
echo ::set-output name=VERSION::${{ github.event.release.tag_name }}
echo ::set-output name=platform::${ARCHITECTURE//-/\/}
echo ::set-output name=cache::${GITHUB_REPOSITORY,,}:${GITHUB_REF//refs\/heads\//}-cache-${{ matrix.architecture }}
echo ::set-output name=tag::${GITHUB_REPOSITORY,,}:${GITHUB_REF//refs\/heads\//}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER}-${{ matrix.architecture }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
@ -44,16 +54,6 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Docker meta
id: metadata
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/gilbn/theme.park
gilbn/theme.park
tags: |
type=ref,event=branch
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
@ -67,46 +67,78 @@ jobs:
username: ${{ secrets.DH_USER }} username: ${{ secrets.DH_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build&push master - name: build&push
if: ${{ github.event.release.target_commitish == 'master' }}
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: latest platforms: ${{ steps.prep.outputs.platform }}
labels: ${{ steps.metadata.outputs.labels }} file: ./${{ matrix.architecture }}.Dockerfile
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }} cache-from: docker.io/${{ steps.prep.outputs.cache }}
cache-to: docker.io/${{ steps.prep.outputs.cache }}
tags: |
docker.io/${{ steps.prep.outputs.tag }}
ghcr.io/${{ steps.prep.outputs.tag }}
labels: |
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.title=${{ steps.prep.outputs.title }}
org.opencontainers.image.revision=${{ steps.prep.outputs.revision }}
org.opencontainers.image.source=${{ steps.prep.outputs.source }}
org.opencontainers.image.vendor=${{ steps.prep.outputs.vendor }}
org.opencontainers.image.url=${{ steps.prep.outputs.url }}
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
build-args: |
TP_RELEASE=${{ steps.prep.outputs.VERSION }}
BUILD_DATE=${{ steps.date_time.outputs.created }}
BUILD_ARCHITECTURE=${{ matrix.architecture }}
- name: manual build&push master publish:
if: ${{ github.event.inputs.branch == 'master' }} runs-on: ubuntu-latest
uses: docker/build-push-action@v2 strategy:
with: matrix:
context: . registry: [docker.io, ghcr.io]
platforms: linux/amd64,linux/arm/v7,linux/arm64 needs: [build-and-push-it-to-the-limit]
push: ${{ github.event_name != 'pull_request' }} steps:
tags: latest, ${{ github.event.inputs.tag }} - name: Checkout
labels: ${{ steps.metadata.outputs.labels }} uses: actions/checkout@v2
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
- name: build&push develop - name: Login to DockerHub
if: ${{ github.ref == 'refs/heads/develop' || github.event.inputs.branch == 'develop' }} if: matrix.registry == 'docker.io'
uses: docker/build-push-action@v2 uses: docker/login-action@v1
with: with:
context: . registry: docker.io
platforms: linux/amd64,linux/arm/v7,linux/arm64 username: ${{ secrets.DH_USER }}
push: ${{ github.event_name != 'pull_request' }} password: ${{ secrets.DOCKERHUB_TOKEN }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }}
- name: build&push testing - name: Login to GitHub Container Registry
if: ${{ github.ref == 'refs/heads/testing' || github.event.inputs.branch == 'testing' }} if: matrix.registry == 'ghcr.io'
uses: docker/build-push-action@v2 uses: docker/login-action@v1
with: with:
context: . registry: ghcr.io
platforms: linux/amd64,linux/arm/v7,linux/arm64 username: ${{ github.repository_owner }}
push: ${{ github.event_name != 'pull_request' }} password: ${{ secrets.GH_PAT }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }} - name: Create manifests
build-args: TP_RELEASE=${{ steps.get_version.outputs.VERSION }},BUILD_DATE=${{ steps.date_time.outputs.NOW }} env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
IMAGE=${{ matrix.registry }}/${GITHUB_REPOSITORY,,}
TAG=${GITHUB_REF//refs\/heads\//}
SOURCE=${IMAGE}:${TAG}-${GITHUB_SHA:0:7}-${GITHUB_RUN_NUMBER}
VERSION=${{ steps.prep.outputs.VERSION }}
[[ -f linux-amd64.Dockerfile ]] && AMD64=${SOURCE}-linux-amd64
[[ -f linux-arm64.Dockerfile ]] && ARM64=${SOURCE}-linux-arm64
[[ -f linux-arm-v7.Dockerfile ]] && ARMV7=${SOURCE}-linux-arm-v7
docker manifest create ${IMAGE}:${TAG} ${AMD64} ${ARM64} ${ARMV7}
docker manifest push ${IMAGE}:${TAG}
if [[! -z "${VERSION}" ]]; then
docker manifest create ${IMAGE}:${TAG}-${VERSION//\~/-} ${AMD64} ${ARM64} ${ARMV7}
docker manifest push ${IMAGE}:${TAG}-${VERSION//\~/-}
docker manifest create ${IMAGE}:${VERSION//\~/-} ${AMD64} ${ARM64} ${ARMV7}
docker manifest push ${IMAGE}:${VERSION//\~/-}
fi
docker manifest create ${IMAGE}:${TAG}-${GITHUB_SHA:0:7} ${AMD64} ${ARM64} ${ARMV7}
docker manifest push ${IMAGE}:${TAG}-${GITHUB_SHA:0:7}
if [[ ${TAG} == master ]]; then
docker manifest create ${IMAGE}:latest ${AMD64} ${ARM64} ${ARMV7}
docker manifest push ${IMAGE}:latest
fi

View File

@ -1,9 +1,9 @@
FROM --platform=${BUILDPLATFORM} ghcr.io/linuxserver/baseimage-alpine-nginx:3.14 FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.14
# set version label # set version label
ARG BUILD_DATE ARG BUILD_DATE
ARG TP_RELEASE ARG TP_RELEASE
LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE} Platform: ${BUILDPLATFORM}" LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE} Platform: ${BUILD_ARCHITECTURE}"
LABEL maintainer="gilbn" LABEL maintainer="gilbn"
LABEL org.opencontainers.image.description DESCRIPTION LABEL org.opencontainers.image.description DESCRIPTION

23
linux-arm-v7.Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.14
# set version label
ARG BUILD_DATE
ARG TP_RELEASE
LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE} Platform: ${BUILD_ARCHITECTURE}"
LABEL maintainer="gilbn"
LABEL org.opencontainers.image.description DESCRIPTION
RUN \
echo " ## Installing packages ## " && \
apk add --no-cache --virtual=build-dependencies \
python3 && \
echo "**** install theme.park ****" && \
mkdir -p /app/themepark
# copy local files
WORKDIR /app
COPY css/ /app/themepark/css/
COPY resources/ /app/themepark/resources/
COPY themes.py index.html CNAME /app/themepark/
COPY docker/root/ /

23
linux-arm64.Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.14
# set version label
ARG BUILD_DATE
ARG TP_RELEASE
LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE} Platform: ${BUILD_ARCHITECTURE}"
LABEL maintainer="gilbn"
LABEL org.opencontainers.image.description DESCRIPTION
RUN \
echo " ## Installing packages ## " && \
apk add --no-cache --virtual=build-dependencies \
python3 && \
echo "**** install theme.park ****" && \
mkdir -p /app/themepark
# copy local files
WORKDIR /app
COPY css/ /app/themepark/css/
COPY resources/ /app/themepark/resources/
COPY themes.py index.html CNAME /app/themepark/
COPY docker/root/ /