Skip to content

Commit

Permalink
test docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
testuser7 committed Feb 12, 2024
1 parent 8da5e09 commit f88d141
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_debian.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build Debian package
on:
push:
branches:
- master
pull_request:

jobs:
Expand Down
57 changes: 38 additions & 19 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ name: Build docker
on:
push:
branches:
- 'master'
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
- '[0-9]+\.[0-9]+\.[0-9]+-RC[0-9]+'
- 'dev'

env:
DOCKERHUB_IMAGE: ${{ github.repository }}
#HUB_IMAGE: testuser07/${{ github.event.repository.name }}
#GHCR_IMAGE: ghcr.io/${{ github.repository }}
IMAGE_NAME: ghcr.io/${{ github.repository }}
IMAGE_TAG: |
${{ github.ref_type == 'tag' && (contains(github.ref_name, '-RC') &&
join('candidate-', github.ref_name) || join('release-', github.ref_name)) || 'latest' }}
join('candidate-', github.ref_name) || join('release-', github.ref_name)) || 'test' }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
Expand All @@ -41,16 +43,23 @@ jobs:
tags: |
${{ env.IMAGE_TAG }}
images: |
${{ env.DOCKERHUB_IMAGE }}
${{ env.IMAGE_NAME }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
#-
# name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PAT }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
Expand All @@ -60,7 +69,7 @@ jobs:
platforms: ${{ matrix.platform }}
provenance: false
outputs: |
type=image,name=${{ env.DOCKERHUB_IMAGE }},push-by-digest=true,name-canonical=true,push=true
type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
-
name: Export digest
run: |
Expand All @@ -78,6 +87,9 @@ jobs:

merge:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- build
steps:
Expand All @@ -99,20 +111,27 @@ jobs:
tags: |
${{ env.IMAGE_TAG }}
images: |
${{ env.DOCKERHUB_IMAGE }}
-
name: Login to DockerHub
${{ env.IMAGE_NAME }}
#-
# name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PAT }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.DOCKERHUB_IMAGE }}@sha256:%s ' *)
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_IMAGE }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
2 changes: 2 additions & 0 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build Ubuntu
on:
push:
branches:
- master
pull_request:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine AS build
RUN apk add --no-cache alpine-sdk gcc linux-headers librtlsdr-dev libxml2-dev cmake libusb-dev bash samurai
RUN git clone https://github.com/steve-m/librtlsdr.git && \
git clone https://github.com/wmbusmeters/wmbusmeters.git && \
git clone https://github.com/testuser7/wmbusmeters.git && \
git clone https://github.com/weetmuts/rtl-wmbus.git && \
git clone https://github.com/merbanan/rtl_433.git && \
git clone https://github.com/ED6E0F17/rtl_reset.git
Expand All @@ -25,7 +25,7 @@ WORKDIR /rtl_reset
RUN make

FROM alpine as scratch
RUN apk add --no-cache mosquitto-clients libstdc++ curl libusb rtl-sdr libxml2 netcat-openbsd
RUN apk add --no-cache mosquitto-clients libstdc++ curl libusb rtl-sdr libxml2 netcat-openbsd bash
WORKDIR /wmbusmeters
COPY --from=build /librtlsdr/build/src/librtlsdr.so.* /usr/lib/
COPY --from=build /librtlsdr/rtl-sdr.rules /usr/lib/udev/rules.d/rtl-sdr.rules
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

[ ! -d /wmbusmeters_data/logs/meter_readings ] && mkdir -p /wmbusmeters_data/logs/meter_readings
[ ! -d /wmbusmeters_data/etc/wmbusmeters.d ] && mkdir -p /wmbusmeters_data/etc/wmbusmeters.d
Expand Down

0 comments on commit f88d141

Please sign in to comment.