136 lines
4.5 KiB
Docker
136 lines
4.5 KiB
Docker
# Debian Bullseye for that slightly older and more compat glibc
|
|
FROM debian:bullseye
|
|
|
|
# compile tools we need including for cross compiling to windows and arm8
|
|
# also ssl certs, ssh, and jq for deployment related tasks
|
|
# and set locale per adoptium jdk focale Dockerfile
|
|
RUN set -eux; \
|
|
apt-get update; \
|
|
apt-get install -y --no-install-recommends \
|
|
bash \
|
|
build-essential \
|
|
openssl \
|
|
libssl-dev \
|
|
git \
|
|
wget curl \
|
|
unzip \
|
|
fontconfig \
|
|
netcat git wget libc6-dev make gcc g++ pkg-config \
|
|
jq openssh-client ca-certificates p11-kit tzdata locales \
|
|
g++-mingw-w64-x86-64 \
|
|
nsis \
|
|
wine \
|
|
wine64 \
|
|
; \
|
|
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
|
|
locale-gen en_US.UTF-8; \
|
|
rm -rf /var/lib/apt/lists/*;
|
|
|
|
|
|
# https://github.com/adoptium/containers/blob/main/8/jdk/ubuntu/focal/Dockerfile
|
|
|
|
ENV JAVA_HOME /opt/java/openjdk
|
|
ENV PATH $JAVA_HOME/bin:$PATH
|
|
# Default to UTF-8 file.encoding
|
|
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
|
|
|
|
ENV JAVA_VERSION jdk8u402-b06
|
|
|
|
RUN set -eux; \
|
|
ARCH="$(dpkg --print-architecture)"; \
|
|
ESUM='fcfd08abe39f18e719e391f2fc37b8ac1053075426d10efac4cbf8969e7aa55e'; \
|
|
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u402-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u402b06.tar.gz'; \
|
|
wget --progress=dot:giga -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
|
|
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
|
|
mkdir -p "$JAVA_HOME"; \
|
|
tar --extract \
|
|
--file /tmp/openjdk.tar.gz \
|
|
--directory "$JAVA_HOME" \
|
|
--strip-components 1 \
|
|
--no-same-owner \
|
|
; \
|
|
rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/lib/src.zip; \
|
|
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472
|
|
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
|
|
ldconfig;
|
|
|
|
RUN set -eux; \
|
|
echo "Verifying install ..."; \
|
|
echo "javac -version"; javac -version; \
|
|
echo "java -version"; java -version; \
|
|
echo "Complete."
|
|
|
|
# Android section of this Dockerfile from https://medium.com/@elye.project/intro-to-docker-building-android-app-cb7fb1b97602
|
|
|
|
ENV SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" \
|
|
ANDROID_HOME="/usr/local/android-sdk" \
|
|
ANDROID_SDK=$ANDROID_HOME \
|
|
ANDROID_VERSION=31 \
|
|
ANDROID_BUILD_TOOLS_VERSION=30.0.2
|
|
|
|
## Download Android SDK
|
|
RUN mkdir -p "$ANDROID_HOME" .android \
|
|
&& cd "$ANDROID_HOME" \
|
|
&& curl -o sdk.zip $SDK_URL \
|
|
&& unzip sdk.zip \
|
|
&& rm sdk.zip \
|
|
&& yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
|
|
|
|
## Install Android Build Tool and Libraries
|
|
RUN $ANDROID_HOME/tools/bin/sdkmanager --update
|
|
RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
|
|
"platforms;android-${ANDROID_VERSION}" \
|
|
"platform-tools"
|
|
|
|
# Install NDK
|
|
ENV NDK_VER="22.1.7171670"
|
|
RUN $ANDROID_HOME/tools/bin/sdkmanager "ndk;$NDK_VER"
|
|
RUN ln -sf $ANDROID_HOME/ndk/$NDK_VER $ANDROID_HOME/ndk-bundle
|
|
|
|
# Go section of this Dockerfile from Docker golang: https://github.com/docker-library/golang/blob/master/1.10/alpine3.8/Dockerfile
|
|
# Adapted from alpine apk to debian apt
|
|
|
|
## set up nsswitch.conf for Go's "netgo" implementation
|
|
## - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
|
|
## - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
|
|
RUN echo 'hosts: files dns' > /etc/nsswitch.conf
|
|
|
|
ENV GOLANG_VERSION=1.21.5.linux-amd64
|
|
ENV GOLANG_SHA256=e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e
|
|
|
|
RUN set -eux; \
|
|
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.tar.gz"; \
|
|
echo "$GOLANG_SHA256 *go.tgz" | sha256sum -c -; \
|
|
tar -C /usr/local -xzf go.tgz; \
|
|
rm go.tgz; \
|
|
\
|
|
export PATH="/usr/local/go/bin:$PATH"; \
|
|
go version
|
|
|
|
# persist new go in PATH
|
|
ENV PATH=/usr/local/go/bin:$PATH
|
|
|
|
ENV GOMOBILEPATH=/gomobile
|
|
# Setup /workspace
|
|
RUN mkdir $GOMOBILEPATH
|
|
# Set up GOPATH in /workspace
|
|
ENV GOPATH=$GOMOBILEPATH
|
|
ENV PATH=$GOMOBILEPATH/bin:$PATH
|
|
RUN mkdir -p "$GOMOBILEPATH/src" "$GOMOBILEPATH/bin" "$GOMOBILEPATH/pkg" && chmod -R 777 "$GOMOBILEPATH"
|
|
|
|
# 2022.11.09
|
|
ENV GOMOBILEHASH=43a0384520996c8376bfb8637390f12b44773e65
|
|
|
|
# install gomobile
|
|
RUN cd $GOMOBILEPATH/src; \
|
|
mkdir -p golang.org/x; \
|
|
cd golang.org/x; \
|
|
git clone https://github.com/golang/mobile.git; \
|
|
cd mobile; \
|
|
git checkout $GOMOBILEHASH;
|
|
|
|
RUN go install golang.org/x/mobile/cmd/gomobile@$GOMOBILEHASH
|
|
RUN go install golang.org/x/mobile/cmd/gobind@$GOMOBILEHASH
|
|
|
|
RUN gomobile clean
|