Skip to content

Build Docker Images #3792

Build Docker Images

Build Docker Images #3792

Workflow file for this run

name: Build Docker Images
# This workflow is triggered on a schedule and can also be triggered manually
on:
schedule:
# Every 4 hours
- cron: '0 */4 * * *'
workflow_dispatch:
inputs:
stream:
description: 'Flatcar Stream'
required: true
default: 'stable'
jobs:
build:
# outputs:
# status: ${{ steps.early.conclusion }}
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flatcar_track: ['stable', 'beta', 'alpha']
env:
DOCKER_HUB_USERNAME: 'mediadepot'
DOCKER_HUB_REPO: 'flatcar-developer'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download and Convert Flatcar Developer Container
run: |
echo "=========================== Check ==========================="
curl https://${{matrix.flatcar_track}}.release.flatcar-linux.net/amd64-usr/current/version.txt -o version.txt
cat version.txt
export $(cat version.txt | xargs)
if [ "${{github.event_name}}" != "workflow_dispatch" ]; then
curl -s https://hub.docker.com/v2/repositories/${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}/tags/?page_size=10000 |
jq -e "[.results | .[] | .name == \"${FLATCAR_VERSION}\"] | any | not" || (echo "Tag '${FLATCAR_VERSION}' already exists" && exit 0);
fi
echo "=========================== Download Developer Container ==========================="
curl -L https://${{matrix.flatcar_track}}.release.flatcar-linux.net/amd64-usr/${FLATCAR_VERSION}/flatcar_developer_container.bin.bz2 -o flatcar_developer_container.bin.bz2
bunzip2 -k flatcar_developer_container.bin.bz2
mkdir ${FLATCAR_VERSION}
sudo mount -o ro,loop,offset=2097152 flatcar_developer_container.bin ${FLATCAR_VERSION}
sudo tar -cp --one-file-system -C ${FLATCAR_VERSION} . | docker import - ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:${FLATCAR_VERSION}
rm -rf flatcar_developer_container.bin flatcar_developer_container.bin.bz2
echo "=========================== Push Image ==========================="
docker login -u="analogj" -p="${{ secrets.DOCKER_HUB_PASSWORD }}"
docker push ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:${FLATCAR_VERSION}
- name: Create Developer Image with Sources
run: |
echo "=========================== Check ==========================="
curl https://${{matrix.flatcar_track}}.release.flatcar-linux.net/amd64-usr/current/version.txt -o version.txt
cat version.txt
export $(cat version.txt | xargs)
if [ "${{github.event_name}}" != "workflow_dispatch" ]; then
curl -s https://hub.docker.com/v2/repositories/${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}/tags/?page_size=10000 |
jq -e "[.results | .[] | .name == \"${FLATCAR_VERSION}-sources\"] | any | not" || (echo "Tag '${FLATCAR_VERSION}-sources' already exists" && exit 0);
fi
echo "=========================== Build Developer Container w/Sources ==========================="
docker image build \
--build-arg FLATCAR_VERSION=${FLATCAR_VERSION} \
--build-arg FLATCAR_BUILD=${FLATCAR_BUILD} \
--build-arg FLATCAR_TRACK=${{matrix.flatcar_track}} \
--tag ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:${FLATCAR_VERSION}-sources \
- < Dockerfile
echo "=========================== Push Images ==========================="
docker login -u="analogj" -p="${{ secrets.DOCKER_HUB_PASSWORD }}"
docker push ${DOCKER_HUB_USERNAME}/${DOCKER_HUB_REPO}:${FLATCAR_VERSION}-sources
- uses: gautamkrishnar/keepalive-workflow@v1 # using the workflow with default settings