mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-21 17:15:25 +03:00
parent
8bcf4ebfbf
commit
dacc586dca
7 changed files with 84 additions and 74 deletions
60
.github/workflows/dockerbuild.yml
vendored
Normal file
60
.github/workflows/dockerbuild.yml
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
name: Build Image on Commit and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- '20*'
|
||||
|
||||
env:
|
||||
DOCKERHUB_SLUG: rssbridge/rss-bridge
|
||||
GHCR_SLUG: ghcr.io/rss-bridge/rss-bridge
|
||||
|
||||
jobs:
|
||||
bake:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2.3.4
|
||||
-
|
||||
name: Docker meta
|
||||
id: docker_meta
|
||||
uses: docker/metadata-action@v3.5.0
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKERHUB_SLUG }}
|
||||
${{ env.GHCR_SLUG }}
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/20') }}
|
||||
type=raw,value=stable,enable=${{ startsWith(github.ref, 'refs/tags/20') }}
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1.6.0
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v1.10.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1.10.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/bake-action@v1.6.0
|
||||
with:
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
${{ steps.docker_meta.outputs.bake-file }}
|
||||
targets: image-all
|
||||
push: true
|
17
Dockerfile
17
Dockerfile
|
@ -1,24 +1,9 @@
|
|||
ARG FROM_ARCH=amd64
|
||||
|
||||
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
|
||||
FROM alpine AS builder
|
||||
|
||||
# Download QEMU
|
||||
ADD https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-arm.tar.gz .
|
||||
RUN tar zxvf qemu-5.2.0.balena4-arm.tar.gz --strip-components 1
|
||||
ADD https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-aarch64.tar.gz .
|
||||
RUN tar zxvf qemu-5.2.0.balena4-aarch64.tar.gz --strip-components 1
|
||||
|
||||
FROM $FROM_ARCH/php:7-apache
|
||||
FROM php:7-apache
|
||||
|
||||
LABEL description="RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for websites that don't have one."
|
||||
LABEL repository="https://github.com/RSS-Bridge/rss-bridge"
|
||||
LABEL website="https://github.com/RSS-Bridge/rss-bridge"
|
||||
|
||||
# Add QEMU
|
||||
COPY --from=builder qemu-arm-static /usr/bin
|
||||
COPY --from=builder qemu-aarch64-static /usr/bin
|
||||
|
||||
ENV APACHE_DOCUMENT_ROOT=/app
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
|
||||
|
|
23
docker-bake.hcl
Normal file
23
docker-bake.hcl
Normal file
|
@ -0,0 +1,23 @@
|
|||
target "docker-metadata-action" {}
|
||||
|
||||
group "default" {
|
||||
targets = ["image-local"]
|
||||
}
|
||||
|
||||
target "image" {
|
||||
inherits = ["docker-metadata-action"]
|
||||
}
|
||||
|
||||
target "image-local" {
|
||||
inherits = ["image"]
|
||||
output = ["type=docker"]
|
||||
}
|
||||
|
||||
target "image-all" {
|
||||
inherits = ["image"]
|
||||
platforms = [
|
||||
"linux/amd64",
|
||||
"linux/arm64",
|
||||
"linux/arm/v7"
|
||||
]
|
||||
}
|
10
hooks/build
10
hooks/build
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Custom build script to build images for all supported architectures.
|
||||
# Example for IMAGE_NAME: rss-builder/rss-builder:stable
|
||||
|
||||
for arch in amd64 arm32v7 arm64v8
|
||||
do
|
||||
echo "Building $IMAGE_NAME-$arch"
|
||||
docker build --build-arg FROM_ARCH=$arch --file $DOCKERFILE_PATH --tag $IMAGE_NAME-$arch .
|
||||
done
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Use manifest-tool to create the manifest, given the experimental
|
||||
# "docker manifest" command isn't available yet on Docker Hub.
|
||||
MANIFEST_TOOL_VERSION=$(curl -s https://api.github.com/repos/estesp/manifest-tool/releases/latest | grep 'tag_name' | cut -d\" -f4)
|
||||
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/$MANIFEST_TOOL_VERSION/manifest-tool-linux-amd64
|
||||
chmod +x manifest-tool
|
||||
|
||||
# Generate the manifest file.
|
||||
# Parameter 1 is the multi-arch image name, e.g. rss-bridge/rss-bridge:stable
|
||||
function generate_manifest {
|
||||
cat > manifest-generated.yaml << EOF
|
||||
image: $1
|
||||
manifests:
|
||||
- image: $1-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
- image: $1-arm32v7
|
||||
platform:
|
||||
architecture: arm
|
||||
os: linux
|
||||
variant: v7
|
||||
- image: $1-arm64v8
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
variant: v8
|
||||
EOF
|
||||
}
|
||||
|
||||
echo "Pushing multi-arch manifest $IMAGE_NAME"
|
||||
generate_manifest $IMAGE_NAME
|
||||
./manifest-tool push from-spec manifest-generated.yaml
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Register qemu-*-static for all supported processors except the
|
||||
# current one, but also remove all registered binfmt_misc before
|
||||
docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Custom build script to push images for all supported architectures.
|
||||
|
||||
for arch in amd64 arm32v7 arm64v8
|
||||
do
|
||||
echo "Pushing $IMAGE_NAME-$arch"
|
||||
docker push $IMAGE_NAME-$arch
|
||||
done
|
Loading…
Reference in a new issue