Skip to content

Commit

Permalink
chore: add base rootfs to release
Browse files Browse the repository at this point in the history
  • Loading branch information
leavesster committed Oct 22, 2024
1 parent 49a7c06 commit 89ed570
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: build image
on:
pull_request:
paths:
- "base.dockerfile"
- ".github/workflows/base.yaml"
push:
paths:
- "base.dockerfile"
- ".github/workflows/base.yaml"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/oomol/base-rootfs
tags: |
type=sha
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
flavor: |
latest=auto
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.ref_type == 'tag' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: base.dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
- name: export rootfs
run: |
docker run -d --name rootfs-export ${{ steps.meta.outputs.images }}
docker export rootfs-export > base-rootfs-amd64.tar
- name: Release
uses: softprops/action-gh-release@v2
with:
files: base-rootfs-amd64.tar
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.sha }}
body: ${{ github.sha }}
draft: false
prerelease: false
make_latest: true
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
npmrc=.npmrc
file: .Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max
7 changes: 7 additions & 0 deletions base.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:latest

RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
--mount=target=/var/cache/apt,type=cache,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt update \
&& apt install -y --no-install-recommends locales-all tar xz-utils uuid-runtime

0 comments on commit 89ed570

Please sign in to comment.