-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
70 lines (44 loc) · 2.14 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
65
66
67
68
69
70
# ===========================================
FROM haxe:4.1 AS haxe-build
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# install dependencies
COPY game-js.hxml /usr/src/app/
RUN yes | haxelib --quiet install all
# compile the project
COPY . /usr/src/app
RUN haxe game-js.hxml
# ===========================================
FROM scratch AS haxe-output
COPY --from=haxe-build /usr/src/app/build /
# ===========================================
FROM beevelop/cordova:v2021.02.1 AS cordova-build
RUN apt-get -y update && apt-get -y install git
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app/cordova
COPY . /usr/src/app
RUN rm -rf www/build
COPY --from=haxe-build /usr/src/app/build /usr/src/app/cordova/www/build
# Debug: not sure why I need this but on Github Actions it's needed.
RUN cordova platform add android; exit 0
# ===========================================
FROM cordova-build AS build-unsigned-apk
RUN cordova build android
# ===========================================
FROM cordova-build AS build-signed-apk
RUN --mount=type=secret,id=keystore-base64 cat /run/secrets/keystore-base64 | base64 --decode > android.keystore
RUN --mount=type=secret,id=keystore-password KEYSTORE_PASSWORD="$(cat /run/secrets/keystore-password)" \
&& cordova build --release android -- --keystore=your-android.keystore --alias=your-alias --storePassword=${KEYSTORE_PASSWORD} --password=${KEYSTORE_PASSWORD} --packageType=apk
# ===========================================
FROM scratch AS cordova-output-unsigned
COPY --from=build-unsigned-apk /usr/src/app/cordova/platforms/android/app/build/outputs/apk/debug/app-debug.apk /
FROM scratch AS cordova-output-signed
COPY --from=build-signed-apk /usr/src/app/cordova/platforms/android/app/build/outputs/apk/release/app-release.apk /
# ===========================================
FROM node:15.11 AS upload-to-play
RUN npm i -g [email protected] && apkup --version
COPY --from=cordova-output-signed /usr/src/app/cordova/platforms/android/app/build/outputs/apk/release/app-release.apk .
RUN --mount=type=secret,id=service-account DEBUG=* apkup \
--key /run/secrets/service-account \
--apk app-release.apk \
--track internal