Skip to content

Commit dacc586

Browse files
authored
New docker build mechanism (RSS-Bridge#2268)
* New docker build mechanism
1 parent 8bcf4eb commit dacc586

File tree

7 files changed

+84
-74
lines changed

7 files changed

+84
-74
lines changed

.github/workflows/dockerbuild.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build Image on Commit and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
tags:
8+
- '20*'
9+
10+
env:
11+
DOCKERHUB_SLUG: rssbridge/rss-bridge
12+
GHCR_SLUG: ghcr.io/rss-bridge/rss-bridge
13+
14+
jobs:
15+
bake:
16+
runs-on: ubuntu-latest
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/[email protected]
21+
-
22+
name: Docker meta
23+
id: docker_meta
24+
uses: docker/[email protected]
25+
with:
26+
images: |
27+
${{ env.DOCKERHUB_SLUG }}
28+
${{ env.GHCR_SLUG }}
29+
tags: |
30+
type=raw,value=latest
31+
type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/20') }}
32+
type=raw,value=stable,enable=${{ startsWith(github.ref, 'refs/tags/20') }}
33+
-
34+
name: Set up QEMU
35+
uses: docker/setup-qemu-action@v1
36+
-
37+
name: Set up Docker Buildx
38+
uses: docker/[email protected]
39+
-
40+
name: Login to DockerHub
41+
uses: docker/[email protected]
42+
with:
43+
username: ${{ secrets.DOCKER_USERNAME }}
44+
password: ${{ secrets.DOCKER_PASSWORD }}
45+
-
46+
name: Login to GitHub Container Registry
47+
uses: docker/[email protected]
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
-
53+
name: Build and push
54+
uses: docker/[email protected]
55+
with:
56+
files: |
57+
./docker-bake.hcl
58+
${{ steps.docker_meta.outputs.bake-file }}
59+
targets: image-all
60+
push: true

Dockerfile

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
ARG FROM_ARCH=amd64
2-
3-
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
4-
FROM alpine AS builder
5-
6-
# Download QEMU
7-
ADD https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-arm.tar.gz .
8-
RUN tar zxvf qemu-5.2.0.balena4-arm.tar.gz --strip-components 1
9-
ADD https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-aarch64.tar.gz .
10-
RUN tar zxvf qemu-5.2.0.balena4-aarch64.tar.gz --strip-components 1
11-
12-
FROM $FROM_ARCH/php:7-apache
1+
FROM php:7-apache
132

143
LABEL description="RSS-Bridge is a PHP project capable of generating RSS and Atom feeds for websites that don't have one."
154
LABEL repository="https://github.com/RSS-Bridge/rss-bridge"
165
LABEL website="https://github.com/RSS-Bridge/rss-bridge"
176

18-
# Add QEMU
19-
COPY --from=builder qemu-arm-static /usr/bin
20-
COPY --from=builder qemu-aarch64-static /usr/bin
21-
227
ENV APACHE_DOCUMENT_ROOT=/app
238

249
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \

docker-bake.hcl

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
target "docker-metadata-action" {}
2+
3+
group "default" {
4+
targets = ["image-local"]
5+
}
6+
7+
target "image" {
8+
inherits = ["docker-metadata-action"]
9+
}
10+
11+
target "image-local" {
12+
inherits = ["image"]
13+
output = ["type=docker"]
14+
}
15+
16+
target "image-all" {
17+
inherits = ["image"]
18+
platforms = [
19+
"linux/amd64",
20+
"linux/arm64",
21+
"linux/arm/v7"
22+
]
23+
}

hooks/build

-10
This file was deleted.

hooks/post_push

-34
This file was deleted.

hooks/pre_build

-5
This file was deleted.

hooks/push

-9
This file was deleted.

0 commit comments

Comments
 (0)