-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker] [ci] Dockerfile and Github Actions docker-publish.yml
docker run --rm -ti --privileged=true -v"$(pwd)/output":/root/MagiskOnWSALocal/output galeksandrp/magiskonwsalocal:container
- Loading branch information
1 parent
2726a69
commit 01c77ed
Showing
2 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Docker | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
on: | ||
push: | ||
branches: [ "main", "container" ] | ||
# Publish semver tags as releases. | ||
tags: [ 'v*.*.*' ] | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
#REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
releasetype: [retail, rp, wis, wif] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Install the cosign tool except on PR | ||
# https://github.com/sigstore/cosign-installer | ||
- name: Install cosign | ||
if: github.event_name != 'pull_request' | ||
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 | ||
with: | ||
cosign-release: 'v2.1.1' | ||
|
||
# Set up BuildKit Docker container builder to be able to build | ||
# multi-platform images and export cache | ||
# https://github.com/docker/setup-buildx-action | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: custom - Set environment variables | ||
run: | | ||
echo "IMAGE_NAME=$(echo ${{ github.actor }}/$(echo ${{ github.repository }} | cut -d'/' -f2) | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ matrix.releasetype }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
target: ${{ matrix.releasetype }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# best practice to not use latest tag, drawback is that we need to ensure particular tag compatibility | ||
# and not forget to update tag when migrating to new container major release | ||
FROM ubuntu:jammy AS updated | ||
|
||
# best practice to use absolute pathes https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#workdir | ||
COPY . /root/MagiskOnWSALocal | ||
|
||
# in case you decide to remove executable bit in VCS | ||
RUN chmod +x /root/MagiskOnWSALocal/scripts/install_deps.sh | ||
|
||
WORKDIR /root/MagiskOnWSALocal | ||
|
||
# minimize the number of layers https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get | ||
RUN apt-get update \ | ||
&& apt-get install -y sudo \ | ||
&& /root/MagiskOnWSALocal/scripts/install_deps.sh \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN chmod +x /root/MagiskOnWSALocal/scripts/build.sh | ||
|
||
VOLUME ["/root/MagiskOnWSALocal/output"] | ||
CMD ["sh", "-c", "exec /root/MagiskOnWSALocal/scripts/build.sh --release-type $WSA_RELEASE_TYPE"] | ||
|
||
FROM updated as retail | ||
ENV WSA_RELEASE_TYPE=retail | ||
|
||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver stable || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch arm64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand OpenGApps --magisk-ver beta || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver canary || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver debug || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol kernelsu --gapps-brand MindTheGapps || true | ||
|
||
FROM updated as rp | ||
ENV WSA_RELEASE_TYPE=RP | ||
|
||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver stable || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch arm64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand OpenGApps --magisk-ver beta || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver canary || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver debug || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol kernelsu --gapps-brand MindTheGapps || true | ||
|
||
FROM updated as wis | ||
ENV WSA_RELEASE_TYPE=WIS | ||
|
||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver stable || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch arm64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand OpenGApps --magisk-ver beta || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver canary || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver debug || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol kernelsu --gapps-brand MindTheGapps || true | ||
|
||
FROM updated as wif | ||
ENV WSA_RELEASE_TYPE=WIF | ||
|
||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver stable || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch arm64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand OpenGApps --magisk-ver beta || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver canary || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol magisk --gapps-brand MindTheGapps --magisk-ver debug || true | ||
RUN /root/MagiskOnWSALocal/scripts/build.sh --arch x64 --release-type $WSA_RELEASE_TYPE --root-sol kernelsu --gapps-brand MindTheGapps || true |