Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added auto-build of docker image #3361

Merged
merged 6 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and push docker

on:
release:
types: [published]

# Use the below to integrate into a Beta build from master
# Changes to the Dockerfile to use the manually built Jar
# from the build automation would be required.
# on:
# pull_request:
# branches: [master]
# types: [closed]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:

build_and_push:
name: Build and push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
iBotPeaches marked this conversation as resolved.
Show resolved Hide resolved
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get hash
id: hash
run: echo "APKTOOL_HASH=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
- name: Get release tag
id: tag
run: echo "APKTOOL_TAG=$(echo ${GITHUB_REF:-no-tag} |sed 's|refs/tags/||g')" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
file: ./Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APKTOOL_HASH }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APKTOOL_TAG }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
14 changes: 8 additions & 6 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
We provide an easy way to leverage `apktool`, along with common Android tools such as `zipalign` and `apksigner`, all from within Docker.

## Building the Docker image
To build the image, use the included Dockerfile:
To use the image, pull or build with the included Dockerfile:
```bash
docker build -t apktool:latest .
docker pull ghcr.io/ibotpeaches/apktool:latest
# OR
docker build -t apktool:local .
```

## Using the Docker image
The best way to use the image is to create aliases to run the internal commands:
The best way to use the image is to create aliases to run the internal commands. Replace `ghcr.io/ibotpeaches/apktool:latest` with `apktool:local` if you have built the image locally.
```bash
alias apktool="docker run --rm -ti --name=apktool -v \"${PWD}:${PWD}\" -w \"${PWD}\" apktool:latest apktool"
alias zipalign="docker run --rm -ti --name=zipalign -v \"${PWD}:${PWD}\" -w \"${PWD}\" apktool:latest zipalign"
alias apksigner="docker run --rm -ti --name=apksigner -v \"${PWD}:${PWD}\" -w \"${PWD}\" apktool:latest apksigner"
alias apktool="docker run --rm -ti --name=apktool -v \"${PWD}:${PWD}\" -w \"${PWD}\" ghcr.io/ibotpeaches/apktool:latest apktool"
alias zipalign="docker run --rm -ti --name=zipalign -v \"${PWD}:${PWD}\" -w \"${PWD}\" ghcr.io/ibotpeaches/apktool:latest zipalign"
alias apksigner="docker run --rm -ti --name=apksigner -v \"${PWD}:${PWD}\" -w \"${PWD}\" ghcr.io/ibotpeaches/apktool:latest apksigner"
```

## Running the commands
Expand Down