Skip to content

Commit b08e189

Browse files
committed
Update
1 parent 45fcd0e commit b08e189

File tree

3 files changed

+69
-72
lines changed

3 files changed

+69
-72
lines changed

.github/workflows/default.yaml

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: Docker Images Builder
22

33
on:
4+
pull_request:
45
push:
56
branches:
6-
- "!*"
7+
- master
78
tags:
89
- v*
910

@@ -21,7 +22,7 @@ env:
2122
QUAY_USER: alvr
2223

2324
DEFAULT_JDK_VERSION: 11
24-
LATEST_STABLE_API: 32
25+
LATEST_STABLE_API: 33
2526

2627
jobs:
2728
build_base_images:
@@ -34,64 +35,72 @@ jobs:
3435

3536
steps:
3637
- name: Checkout
37-
uses: actions/checkout@v2
38+
uses: actions/checkout@v3
3839

39-
- name: Tags
40+
- name: Set environment variables
4041
shell: sh
4142
run: |
4243
set -eu
4344
44-
TAGS="jdk${{ matrix.jdk }}"
45-
TAGS="$TAGS,latest-jdk${{ matrix.jdk }}"
46-
if [ "${{ matrix.jdk }}" = "${{ env.DEFAULT_JDK_VERSION }}" ]; then
47-
TAGS="$TAGS,latest"
48-
fi
49-
echo "TAGS=$TAGS" >> $GITHUB_ENV
45+
case ${{ matrix.jdk }} in
46+
8)
47+
CMDLINE_VERSION="8.0"
48+
SDK_TOOLS_VERSION="9123335" ;;
49+
*)
50+
CMDLINE_VERSION="9.0"
51+
SDK_TOOLS_VERSION="9477386" ;;
52+
esac
53+
echo "CMDLINE_VERSION=${CMDLINE_VERSION}" >> $GITHUB_ENV
54+
echo "SDK_TOOLS_VERSION=${SDK_TOOLS_VERSION}" >> $GITHUB_ENV
5055
5156
- name: Docker meta
52-
id: docker_meta
53-
uses: crazy-max/ghaction-docker-meta@v1
57+
id: meta
58+
uses: docker/metadata-action@v4
5459
with:
5560
images: |
5661
${{ env.DH_IMAGE_BASE_NAME }}
5762
ghcr.io/${{ env.GHCR_IMAGE_BASE_NAME }}
5863
quay.io/${{ env.QUAY_IMAGE_BASE_NAME }}
59-
tag-custom: ${{ env.TAGS }}
60-
tag-custom-only: true
64+
tags: |
65+
type=raw,value=jdk${{ matrix.jdk }}
66+
type=raw,value=latest-jdk${{ matrix.jdk }}
67+
type=raw,value=latest,enable=${{ matrix.jdk == env.DEFAULT_JDK_VERSION }}
6168
6269
- name: Set up Docker Buildx
63-
uses: docker/setup-buildx-action@v1
70+
uses: docker/setup-buildx-action@v2
6471

6572
- name: Login to DockerHub
66-
uses: docker/login-action@v1
73+
uses: docker/login-action@v2
6774
with:
6875
username: ${{ env.DOCKERHUB_USER }}
6976
password: ${{ secrets.DOCKERHUB_PASS }}
7077

7178
- name: Login to GitHub Container Registry
72-
uses: docker/login-action@v1
79+
uses: docker/login-action@v2
7380
with:
7481
registry: ghcr.io
7582
username: ${{ github.repository_owner }}
7683
password: ${{ secrets.GHCR_PASS }}
7784

7885
- name: Login to Quay
79-
uses: docker/login-action@v1
86+
uses: docker/login-action@v2
8087
with:
8188
registry: quay.io
8289
username: ${{ env.QUAY_USER }}
8390
password: ${{ secrets.QUAY_PASS }}
8491

8592
- name: Build Android Base JDK${{ matrix.jdk }}
86-
uses: docker/build-push-action@v2
93+
uses: docker/build-push-action@v4
8794
with:
8895
context: ./docker
8996
file: ./docker/base.Dockerfile
90-
push: true
91-
tags: ${{ steps.docker_meta.outputs.tags }}
92-
labels: ${{ steps.docker_meta.outputs.labels }}
97+
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
98+
tags: ${{ steps.meta.outputs.tags }}
99+
labels: ${{ steps.meta.outputs.labels }}
93100
build-args: |
94101
JDK_VERSION=${{ matrix.jdk }}
102+
CMDLINE_VERSION=${{ env.CMDLINE_VERSION }}
103+
SDK_TOOLS_VERSION=${{ env.SDK_TOOLS_VERSION }}
95104
96105
build_images:
97106
name: Build Alpine Android Image
@@ -105,30 +114,13 @@ jobs:
105114

106115
steps:
107116
- name: Checkout
108-
uses: actions/checkout@v2
109-
110-
- name: Get tag version
111-
id: tag_version
112-
uses: battila7/get-version-action@v2
117+
uses: actions/checkout@v3
113118

114119
- name: Set environment variables
115120
shell: sh
116121
run: |
117122
set -eu
118123
119-
TAGS="android-${{ matrix.android-api }}-jdk${{ matrix.jdk }}"
120-
TAGS="$TAGS,android-${{ matrix.android-api }}-jdk${{ matrix.jdk }}-${{ steps.tag_version.outputs.version }}"
121-
if [ "${{ matrix.jdk }}" = "${{ env.DEFAULT_JDK_VERSION }}" ]; then
122-
TAGS="$TAGS,android-${{ matrix.android-api }}"
123-
fi
124-
if [ "${{ matrix.android-api }}" = "${{ env.LATEST_STABLE_API }}" ]; then
125-
TAGS="$TAGS,latest-jdk${{ matrix.jdk }}"
126-
if [ "${{ matrix.jdk }}" = "${{ env.DEFAULT_JDK_VERSION }}" ]; then
127-
TAGS="$TAGS,latest"
128-
fi
129-
fi
130-
echo "TAGS=$TAGS" >> $GITHUB_ENV
131-
132124
case ${{ matrix.android-api }} in
133125
28) BUILD_TOOLS_VERSION="28.0.3" ;;
134126
29) BUILD_TOOLS_VERSION="29.0.3" ;;
@@ -140,47 +132,51 @@ jobs:
140132
echo "BUILD_TOOLS_VERSION=$BUILD_TOOLS_VERSION" >> $GITHUB_ENV
141133
142134
- name: Docker meta
143-
id: docker_meta
144-
uses: crazy-max/ghaction-docker-meta@v1
135+
id: meta
136+
uses: docker/metadata-action@v4
145137
with:
146138
images: |
147139
${{ env.DH_IMAGE_NAME }}
148140
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
149141
quay.io/${{ env.QUAY_IMAGE_NAME }}
150-
tag-custom: ${{ env.TAGS }}
151-
tag-custom-only: true
142+
tags: |
143+
type=raw,value=android-${{ matrix.android-api }}-jdk${{ matrix.jdk }}
144+
type=raw,value=android-${{ matrix.android-api }}-jdk${{ matrix.jdk }}-${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
145+
type=raw,value=android-${{ matrix.android-api }},enable=${{ matrix.jdk == env.DEFAULT_JDK_VERSION }}
146+
type=raw,value=latest-jdk${{ matrix.jdk }},enable=${{ matrix.android-api == env.LATEST_STABLE_API }}
147+
type=raw,value=latest,enable=${{ matrix.android-api == env.LATEST_STABLE_API && matrix.jdk == env.DEFAULT_JDK_VERSION }}
152148
153149
- name: Set up Docker Buildx
154-
uses: docker/setup-buildx-action@v1
150+
uses: docker/setup-buildx-action@v2
155151

156152
- name: Login to DockerHub
157-
uses: docker/login-action@v1
153+
uses: docker/login-action@v2
158154
with:
159155
username: ${{ env.DOCKERHUB_USER }}
160156
password: ${{ secrets.DOCKERHUB_PASS }}
161157

162158
- name: Login to GitHub Container Registry
163-
uses: docker/login-action@v1
159+
uses: docker/login-action@v2
164160
with:
165161
registry: ghcr.io
166162
username: ${{ github.repository_owner }}
167163
password: ${{ secrets.GHCR_PASS }}
168164

169165
- name: Login to Quay
170-
uses: docker/login-action@v1
166+
uses: docker/login-action@v2
171167
with:
172168
registry: quay.io
173169
username: ${{ env.QUAY_USER }}
174170
password: ${{ secrets.QUAY_PASS }}
175171

176172
- name: Build Android API ${{ matrix.android-api }} JDK${{ matrix.jdk }}
177-
uses: docker/build-push-action@v2
173+
uses: docker/build-push-action@v4
178174
with:
179175
context: ./docker
180176
file: ./docker/android.Dockerfile
181-
push: true
182-
tags: ${{ steps.docker_meta.outputs.tags }}
183-
labels: ${{ steps.docker_meta.outputs.labels }}
177+
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
178+
tags: ${{ steps.meta.outputs.tags }}
179+
labels: ${{ steps.meta.outputs.labels }}
184180
build-args: |
185181
JDK_VERSION=${{ matrix.jdk }}
186182
BUILD_TOOLS=${{ env.BUILD_TOOLS_VERSION }}

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</p>
66

77
<p align="center">
8-
<a href="https://github.com/alvr/alpine-android/actions/workflows/default.yaml"><img alt="GitHub build status" src="https://img.shields.io/github/workflow/status/alvr/alpine-android/Docker%20Images%20Builder?logo=github"/></a>
8+
<a href="https://github.com/alvr/alpine-android/actions/workflows/default.yaml"><img alt="GitHub build status" src="https://img.shields.io/github/actions/workflow/status/alvr/alpine-android/default.yaml?logo=github"/></a>
99
<a href="https://github.com/alvr/alpine-android/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/alvr/alpine-android?logo=android&logoColor=white&color=066da5"/></a>
1010
<a href="https://newreleases.io/dockerhub/alvrme/alpine-android"><img alt="Notify new versions" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-get%20notified-%23005cc5"/></a>
1111
</p>
@@ -33,9 +33,9 @@
3333

3434
There are three variants of the image, all based on `bellsoft/liberica-openjdk-alpine`:
3535

36-
* JDK8 images are based on Liberica JDK 8u352-8 and uses the tag's suffix `-jdk8`.
37-
* JDK11 images are based on Liberica JDK 11.0.7-7 and uses the tag's suffix `-jdk11`.
38-
* JDK17 images are based on Liberica JDK 17.0.5-8 and uses the tag's suffix `-jdk17`.
36+
* JDK8 images are based on Liberica JDK 8u362-9 and uses the tag's suffix `-jdk8`.
37+
* JDK11 images are based on Liberica JDK 11.0.18-10 and uses the tag's suffix `-jdk11`.
38+
* JDK17 images are based on Liberica JDK 17.0.6-10 and uses the tag's suffix `-jdk17`.
3939

4040
### Which one should I use?
4141

@@ -59,8 +59,8 @@ implementation("org.glassfish.jaxb:jaxb-runtime:2.3.3")
5959
| Android 10 (29) | `android-29-jdk8` | `android-29`, `android-29-jdk11` | `android-29-jdk17` |
6060
| Android 11 (30) | `android-30-jdk8` | `android-30`, `android-30-jdk11` | `android-30-jdk17` |
6161
| Android 12 (31) | `android-31-jdk8` | `android-31`, `android-31-jdk11` | `android-31-jdk17` |
62-
| Android 12L (32) | `android-32-jdk8`, `latest-jdk8` | `android-32`, `android-32-jdk11`, `latest`, `latest-jdk11` | `android-32-jdk17`, `latest-jdk17` |
63-
| Android 13 (33) | `android-33-jdk8` | `android-33`, `android-33-jdk11` | `android-33-jdk17` |
62+
| Android 12L (32) | `android-32-jdk8` | `android-32`, `android-32-jdk11` | `android-32-jdk17` |
63+
| Android 13 (33) | `android-33-jdk8`, `latest-jdk8` | `android-33`, `android-33-jdk11`, `latest`, `latest-jdk11` | `android-33-jdk17`, `latest-jdk17` |
6464

6565
> :warning: The tags `latest` and `android-XX` will be using the JDK8 base image until July 28th, 2022. After that date, those tags will be targeting JDK11.
6666

docker/base.Dockerfile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@ ARG JDK_VERSION
33
FROM bellsoft/liberica-openjdk-alpine:${JDK_VERSION}
44
LABEL maintainer="Álvaro Salcedo García <[email protected]>"
55

6+
ARG CMDLINE_VERSION
7+
ARG SDK_TOOLS_VERSION
8+
69
ENV ANDROID_SDK_ROOT "/opt/sdk"
710
ENV ANDROID_HOME ${ANDROID_SDK_ROOT}
8-
ENV CMDLINE_VERSION "8.0"
9-
ENV SDK_TOOLS "9123335"
1011
ENV PATH $PATH:${ANDROID_SDK_ROOT}/cmdline-tools/${CMDLINE_VERSION}/bin:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/extras/google/instantapps
1112

12-
RUN apk upgrade && \
13-
apk add --no-cache bash curl git unzip wget coreutils && \
14-
rm -rf /tmp/* && \
15-
rm -rf /var/cache/apk/* && \
16-
wget -q https://dl.google.com/android/repository/commandlinetools-linux-${SDK_TOOLS}_latest.zip -O /tmp/tools.zip && \
17-
mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
18-
unzip -qq /tmp/tools.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \
19-
mv ${ANDROID_SDK_ROOT}/cmdline-tools/* ${ANDROID_SDK_ROOT}/cmdline-tools/${CMDLINE_VERSION} && \
20-
rm -v /tmp/tools.zip && \
21-
mkdir -p ~/.android/ && touch ~/.android/repositories.cfg && \
22-
yes | sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --licenses && \
23-
sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --install "platform-tools" "extras;google;instantapps"
13+
RUN apk upgrade && \
14+
apk add --no-cache bash curl git unzip wget coreutils && \
15+
rm -rf /tmp/* && \
16+
rm -rf /var/cache/apk/* && \
17+
wget -q https://dl.google.com/android/repository/commandlinetools-linux-${SDK_TOOLS_VERSION}_latest.zip -O /tmp/tools.zip && \
18+
mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools && \
19+
unzip -qq /tmp/tools.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools && \
20+
mv ${ANDROID_SDK_ROOT}/cmdline-tools/* ${ANDROID_SDK_ROOT}/cmdline-tools/${CMDLINE_VERSION} && \
21+
rm -v /tmp/tools.zip && \
22+
mkdir -p ~/.android/ && touch ~/.android/repositories.cfg && \
23+
yes | sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --licenses && \
24+
sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --install "platform-tools" "extras;google;instantapps"
2425

2526
COPY ./extras /bin
2627

0 commit comments

Comments
 (0)