From 6a9bc7fead321a1ca1b40eebd3632ee105baab0a Mon Sep 17 00:00:00 2001
From: Andri Joos <andri@joos.io>
Date: Sat, 16 Nov 2024 21:14:03 +0100
Subject: [PATCH] add Dockerfile

---
 Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Dockerfile

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..90d4b8f
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,44 @@
+ARG DEPENDENCY_DIR="/tmp/dependencies"
+ARG BUNDLETOOL_DIR="bundletool"
+ARG BUNDLETOOL_FILENAME="bundletool.jar"
+
+FROM ubuntu:24.04 AS download
+
+ARG DEPENDENCY_DIR
+ARG BUNDLETOOL_DIR
+ARG BUNDLETOOL_FILENAME
+ARG BUNDLETOOL_DIR="${DEPENDENCY_DIR}/${BUNDLETOOL_DIR}"
+ARG BUNDLETOOL_FILE="${BUNDLETOOL_DIR}/${BUNDLETOOL_FILENAME}"
+ARG BUNDLETOOL_VERSION="1.17.2"
+
+RUN apt update \
+    && apt install -y wget
+
+RUN mkdir -p ${BUNDLETOOL_DIR} \
+    && wget "https://github.com/google/bundletool/releases/download/${BUNDLETOOL_VERSION}/bundletool-all-${BUNDLETOOL_VERSION}.jar" -O ${BUNDLETOOL_FILE}
+
+FROM alpine:3
+
+ARG DEPENDENCY_DIR
+ARG USER_UID="1000"
+ARG USER_GID=$USER_UID
+ARG USERNAME="bundletool"
+
+ARG BUNDLETOOL_DIR
+ARG BUNDLETOOL_FILENAME
+ARG BUNDLETOOL_DIR="/${BUNDLETOOL_DIR}"
+ARG BUNDLETOOL_FILE="${BUNDLETOOL_DIR}/${BUNDLETOOL_FILENAME}"
+ARG BUNDLETOOL_BIN=/bin/bundletool
+
+COPY --from=download ${DEPENDENCY_DIR} /
+
+RUN apk add --no-cache bash openjdk17-jdk \
+    && addgroup ${USERNAME} -g ${USER_GID} \
+    && adduser ${USERNAME} --uid ${USER_UID} --ingroup ${USERNAME} --disabled-password \
+    && echo -e '#!/bin/bash\njava -jar '"$BUNDLETOOL_FILE"' "$@"' > ${BUNDLETOOL_BIN} \
+    && chmod +x ${BUNDLETOOL_BIN}
+
+USER ${USERNAME}
+
+# Test
+# RUN bash /bin/bundletool --help && exit 1
-- 
GitLab