Recreate Docker image on every code change (#3276)

* Add switch for clean Docker image preparation
* Link image to our GitHub repository
* Switch to Github repo
* Minimal variant
* Rename
This commit is contained in:
Igor Pečovnik 2021-11-21 09:41:31 +01:00 committed by GitHub
parent 3b1812c002
commit c1b8ab8755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 32 deletions

37
.github/workflows/build-docker.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Build Docker image
on:
# Trigger the workflow on push but only for the main branch
push:
branches:
- master
# Trigger manually
workflow_dispatch:
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- uses: actions/checkout@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
- name: Build Docker image
run: |
sed -i "s/-it --rm/-i --rm/" config/templates/config-docker.conf
touch .ignore_changes
./compile.sh docker JUST_INIT="yes"
docker tag armbian:$(cat VERSION) ghcr.io/armbian/build:$(cat VERSION)
- name: Push Docker image
run: docker push ghcr.io/armbian/build:$(cat VERSION)

View File

@ -1,32 +0,0 @@
name: Build Docker hub image
# This workflow is triggered 1st, 16th and 31st
on:
schedule:
- cron: '0 0 */15 * *'
workflow_dispatch:
jobs:
build:
name: "Build Docker image"
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- uses: actions/checkout@v1
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build Docker image
shell: bash {0}
run: |
sed -i "s/-it --rm/-i --rm/" config/templates/config-docker.conf
touch .ignore_changes
./compile.sh docker KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel"
docker tag armbian:$(cat VERSION) armbian/build:latest
- name: Push Docker image
run: docker push armbian/build:latest

View File

@ -281,6 +281,10 @@ while [[ "${1}" == *=* ]]; do
done
# Used to prepare Docker image
[[ "${JUST_INIT}" == "yes" ]] && exit 0
if [[ "${BUILD_ALL}" == "yes" || "${BUILD_ALL}" == "demo" ]]; then
# shellcheck source=lib/build-all-ng.sh

View File

@ -121,4 +121,5 @@ RUN sed -i 's/\(^STATDOPTS=\).*/\1"--port 32765 --outgoing-port 32766"/' /etc/de
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' TERM=screen
WORKDIR /root/armbian
LABEL org.opencontainers.image.source="https://github.com/armbian/build"
ENTRYPOINT [ "/bin/bash", "/root/armbian/compile.sh" ]