-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (44 loc) · 2.33 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
ARG ANDROID_BUILD_TOOLS_VERSION=29.0.3
ARG ANDROID_SDK_ROOT="/home/gradle/android-sdk"
FROM gradle:8.7-jdk17 AS build-stage
ADD . /java/src/vault-jce
WORKDIR /java/src/vault-jce/
RUN ./gradlew lib:shadowJar
### ANDROID
ARG ANDROID_BUILD_TOOLS_VERSION
ARG ANDROID_SDK_ROOT
ENV SDK_URL="https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip" \
COMMANDLINETOOLS=commandlinetools-linux-11076708_latest.zip \
ANDROID_HOME=$ANDROID_SDK_ROOT \
ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT \
CMD_LINE_TOOL_HOME="$ANDROID_SDK_ROOT/cmdline-tools" \
ANDROID_BUILD_TOOLS_VERSION=${ANDROID_BUILD_TOOLS_VERSION}
# Download Android SDK
ADD --checksum=sha256:2d2d50857e4eb553af5a6dc3ad507a17adf43d115264b1afc116f95c92e5e258 https://dl.google.com/android/repository/${COMMANDLINETOOLS} /
RUN mkdir "$ANDROID_SDK_ROOT" "$CMD_LINE_TOOL_HOME" .android \
&& cd "$ANDROID_SDK_ROOT" \
&& unzip /${COMMANDLINETOOLS} \
&& rm /${COMMANDLINETOOLS} \
&& yes | $CMD_LINE_TOOL_HOME/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT --licenses
# Install Android Build Tool and Libraries
RUN $CMD_LINE_TOOL_HOME/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT --update
# https://developer.android.com/tools#tools-build
RUN $CMD_LINE_TOOL_HOME/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT \
"build-tools;${ANDROID_BUILD_TOOLS_VERSION}"
### OPENJDK
FROM openjdk:17
ARG GIT_COMMIT
ARG VERSION
LABEL GIT_COMMIT=$GIT_COMMIT
LABEL VERSION=$VERSION
RUN microdnf install findutils
ARG ANDROID_BUILD_TOOLS_VERSION
ARG ANDROID_SDK_ROOT
COPY --from=build-stage $ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner $ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner
COPY --from=build-stage $ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/lib/apksigner.jar $ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/lib/apksigner.jar
COPY --from=build-stage /java/src/vault-jce/etc/apksigner $ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner
COPY --from=build-stage /java/src/vault-jce/lib/build/libs/lib-all.jar $ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/lib/vault-jce.jar
ENV PATH="$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:${PATH}"
RUN adduser --disabled-password --gecos "" apksigner
USER apksigner
CMD ["$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION/apksigner"]