| 
 | 1 | +FROM ubuntu:22.04  | 
 | 2 | + | 
 | 3 | +RUN apt-get update \  | 
 | 4 | +    && apt-get -y --no-install-recommends install \  | 
 | 5 | +      grep \  | 
 | 6 | +      libseccomp-dev \  | 
 | 7 | +      libseccomp2 \  | 
 | 8 | +      procps \  | 
 | 9 | +    && rm -rf /var/lib/apt/lists/*  | 
 | 10 | +#  | 
 | 11 | +# Source: https://github.com/docker-library/python/blob/master/3.6/stretch/slim/Dockerfile  | 
 | 12 | +#  | 
 | 13 | + | 
 | 14 | +# ensure local python is preferred over distribution python  | 
 | 15 | +ENV PATH /usr/local/bin:$PATH  | 
 | 16 | + | 
 | 17 | +# http://bugs.python.org/issue19846  | 
 | 18 | +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.  | 
 | 19 | +ENV LANG C.UTF-8  | 
 | 20 | + | 
 | 21 | +# runtime dependencies  | 
 | 22 | +RUN apt-get update && apt-get install -y --no-install-recommends \  | 
 | 23 | +		ca-certificates \  | 
 | 24 | +		netbase \  | 
 | 25 | +	&& rm -rf /var/lib/apt/lists/*  | 
 | 26 | + | 
 | 27 | +ENV GPG_KEY A821E680E5FA6305  | 
 | 28 | +ENV PYTHON_VERSION 3.12.1  | 
 | 29 | + | 
 | 30 | +RUN set -ex \  | 
 | 31 | +	\  | 
 | 32 | +	&& savedAptMark="$(apt-mark showmanual)" \  | 
 | 33 | +	&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \  | 
 | 34 | +		dpkg-dev \  | 
 | 35 | +		gcc \  | 
 | 36 | +		libbz2-dev \  | 
 | 37 | +		libc6-dev \  | 
 | 38 | +		libexpat1-dev \  | 
 | 39 | +		libffi-dev \  | 
 | 40 | +		libgdbm-dev \  | 
 | 41 | +		liblzma-dev \  | 
 | 42 | +		libncursesw5-dev \  | 
 | 43 | +		libreadline-dev \  | 
 | 44 | +		libsqlite3-dev \  | 
 | 45 | +		libssl-dev \  | 
 | 46 | +		make \  | 
 | 47 | +		tk-dev \  | 
 | 48 | +		wget \  | 
 | 49 | +		xz-utils \  | 
 | 50 | +		zlib1g-dev \  | 
 | 51 | +# as of Stretch, "gpg" is no longer included by default  | 
 | 52 | +		$(command -v gpg > /dev/null || echo 'gnupg dirmngr') \  | 
 | 53 | +	\  | 
 | 54 | +	&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \  | 
 | 55 | +	&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \  | 
 | 56 | +	&& export GNUPGHOME="$(mktemp -d)" \  | 
 | 57 | +	&& gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \  | 
 | 58 | +	&& gpg --batch --verify python.tar.xz.asc python.tar.xz \  | 
 | 59 | +	&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \  | 
 | 60 | +	&& rm -rf "$GNUPGHOME" python.tar.xz.asc \  | 
 | 61 | +	&& mkdir -p /usr/src/python \  | 
 | 62 | +	&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \  | 
 | 63 | +	&& rm python.tar.xz \  | 
 | 64 | +	\  | 
 | 65 | +	&& cd /usr/src/python \  | 
 | 66 | +	&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \  | 
 | 67 | +	&& ./configure \  | 
 | 68 | +		--build="$gnuArch" \  | 
 | 69 | +		--enable-loadable-sqlite-extensions \  | 
 | 70 | +		--enable-shared \  | 
 | 71 | +		--with-system-expat \  | 
 | 72 | +		--with-system-ffi \  | 
 | 73 | +		--without-ensurepip \  | 
 | 74 | +	&& make -j "$(nproc)" \  | 
 | 75 | +	&& make install \  | 
 | 76 | +	&& ldconfig \  | 
 | 77 | +	\  | 
 | 78 | +	&& apt-mark auto '.*' > /dev/null \  | 
 | 79 | +	&& apt-mark manual $savedAptMark \  | 
 | 80 | +	&& find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \  | 
 | 81 | +		| awk '/=>/ { print $(NF-1) }' \  | 
 | 82 | +		| sort -u \  | 
 | 83 | +		| xargs -r dpkg-query --search \  | 
 | 84 | +		| cut -d: -f1 \  | 
 | 85 | +		| sort -u \  | 
 | 86 | +		| xargs -r apt-mark manual \  | 
 | 87 | +	&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \  | 
 | 88 | +	&& rm -rf /var/lib/apt/lists/* \  | 
 | 89 | +	\  | 
 | 90 | +	&& find /usr/local -depth \  | 
 | 91 | +		\( \  | 
 | 92 | +			\( -type d -a \( -name test -o -name tests \) \) \  | 
 | 93 | +			-o \  | 
 | 94 | +			\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \  | 
 | 95 | +		\) -exec rm -rf '{}' + \  | 
 | 96 | +	&& rm -rf /usr/src/python \  | 
 | 97 | +	\  | 
 | 98 | +	&& python3 --version  | 
 | 99 | + | 
 | 100 | +# make some useful symlinks that are expected to exist  | 
 | 101 | +RUN cd /usr/local/bin \  | 
 | 102 | +	&& ln -s idle3 idle \  | 
 | 103 | +	&& ln -s pydoc3 pydoc \  | 
 | 104 | +	&& ln -s python3 python \  | 
 | 105 | +	&& ln -s python3-config python-config  | 
 | 106 | + | 
 | 107 | +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"  | 
 | 108 | +ENV PYTHON_PIP_VERSION 23.3.2  | 
 | 109 | + | 
 | 110 | +RUN set -ex; \  | 
 | 111 | +	\  | 
 | 112 | +	savedAptMark="$(apt-mark showmanual)"; \  | 
 | 113 | +	apt-get update; \  | 
 | 114 | +	apt-get install -y --no-install-recommends wget; \  | 
 | 115 | +	\  | 
 | 116 | +	wget -O get-pip.py 'https://bootstrap.pypa.io/pip/get-pip.py'; \  | 
 | 117 | +	\  | 
 | 118 | +	apt-mark auto '.*' > /dev/null; \  | 
 | 119 | +	[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \  | 
 | 120 | +	apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \  | 
 | 121 | +	rm -rf /var/lib/apt/lists/*; \  | 
 | 122 | +	\  | 
 | 123 | +	python get-pip.py \  | 
 | 124 | +		--disable-pip-version-check \  | 
 | 125 | +		--no-cache-dir \  | 
 | 126 | +		"pip==$PYTHON_PIP_VERSION" \  | 
 | 127 | +	; \  | 
 | 128 | +	pip --version; \  | 
 | 129 | +	\  | 
 | 130 | +	find /usr/local -depth \  | 
 | 131 | +		\( \  | 
 | 132 | +			\( -type d -a \( -name test -o -name tests \) \) \  | 
 | 133 | +			-o \  | 
 | 134 | +			\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \  | 
 | 135 | +		\) -exec rm -rf '{}' +; \  | 
 | 136 | +	rm -f get-pip.py; \  | 
 | 137 | +	pip3 install aioconsole; \  | 
 | 138 | +	pip3 uninstall --yes pip setuptools  | 
 | 139 | + | 
 | 140 | +# Necessary as Submitty does path expansion of commands in compiling a homework,  | 
 | 141 | +# and so resolves "python" -> "/usr/bin/python"  | 
 | 142 | +RUN cd /usr/bin \  | 
 | 143 | +	&& ln -s /usr/local/bin/python3 python3 \  | 
 | 144 | +	&& ln -s /usr/local/bin/python3 python \  | 
 | 145 | +	&& ln -s /usr/local/bin/pip3 pip3 \  | 
 | 146 | +	&& ln -s /usr/local/bin/pip3 pip  | 
 | 147 | +#  | 
 | 148 | +# Source: https://github.com/docker-library/openjdk/blob/master/8/jdk/slim/Dockerfile  | 
 | 149 | +#  | 
 | 150 | + | 
 | 151 | +# A few reasons for installing distribution-provided OpenJDK:  | 
 | 152 | +#  | 
 | 153 | +#  1. Oracle.  Licensing prevents us from redistributing the official JDK.  | 
 | 154 | +#  | 
 | 155 | +#  2. Compiling OpenJDK also requires the JDK to be installed, and it gets  | 
 | 156 | +#     really hairy.  | 
 | 157 | +#  | 
 | 158 | +#     For some sample build times, see Debian's buildd logs:  | 
 | 159 | +#       https://buildd.debian.org/status/logs.php?pkg=openjdk-8  | 
 | 160 | + | 
 | 161 | +RUN apt-get update && apt-get install -y --no-install-recommends \  | 
 | 162 | +		bzip2 \  | 
 | 163 | +		unzip \  | 
 | 164 | +		xz-utils \  | 
 | 165 | +	&& rm -rf /var/lib/apt/lists/*  | 
 | 166 | + | 
 | 167 | +RUN apt-get update \  | 
 | 168 | +    && apt-get install -y --no-install-recommends \  | 
 | 169 | +        # emacs \  | 
 | 170 | +        nano \  | 
 | 171 | +        vim \  | 
 | 172 | +    && rm -rf /var/lib/apt/lists/*  | 
 | 173 | + | 
 | 174 | +RUN apt-get update \  | 
 | 175 | +    && apt-get install -y \  | 
 | 176 | +       iproute2 \  | 
 | 177 | +    && rm -rf /var/lib/apt/lists/*  | 
 | 178 | + | 
 | 179 | +# add a simple script that can auto-detect the appropriate JAVA_HOME value  | 
 | 180 | +# based on whether the JDK or only the JRE is installed  | 
 | 181 | +# RUN { \  | 
 | 182 | +# 		echo '#!/bin/sh'; \  | 
 | 183 | +# 		echo 'set -e'; \  | 
 | 184 | +# 		echo; \  | 
 | 185 | +# 		echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \  | 
 | 186 | +# 	} > /usr/local/bin/docker-java-home \  | 
 | 187 | +# 	&& chmod +x /usr/local/bin/docker-java-home  | 
 | 188 | + | 
 | 189 | +# # do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe  | 
 | 190 | +# RUN ln -svT "/usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)" /docker-java-home  | 
 | 191 | +# ENV JAVA_HOME /docker-java-home  | 
 | 192 | + | 
 | 193 | +# # Look here to update: https://packages.ubuntu.com/jammy/openjdk-11-jdk-headless  | 
 | 194 | +# ENV JAVA_VERSION 11.0.21  | 
 | 195 | +# ENV JAVA_UBUNTU_VERSION 11.0.21+9-0ubuntu1~22.04  | 
 | 196 | + | 
 | 197 | +# RUN set -ex; \  | 
 | 198 | +# 	\  | 
 | 199 | +# # deal with slim variants not having man page directories (which causes "update-alternatives" to fail)  | 
 | 200 | +# 	if [ ! -d /usr/share/man/man1 ]; then \  | 
 | 201 | +# 		mkdir -p /usr/share/man/man1; \  | 
 | 202 | +# 	fi; \  | 
 | 203 | +# 	\  | 
 | 204 | +# # ca-certificates-java does not work on src:openjdk-11 with no-install-recommends: (https://bugs.debian.org/914860, https://bugs.debian.org/775775)  | 
 | 205 | +# # /var/lib/dpkg/info/ca-certificates-java.postinst: line 56: java: command not found  | 
 | 206 | +# 	ln -svT /docker-java-home/bin/java /usr/local/bin/java; \  | 
 | 207 | +# 	\  | 
 | 208 | +# 	apt-get update; \  | 
 | 209 | +# 	apt-get install -y --no-install-recommends \  | 
 | 210 | +# 		openjdk-11-jdk-headless="$JAVA_UBUNTU_VERSION" \  | 
 | 211 | +# 	; \  | 
 | 212 | +# 	rm -rf /var/lib/apt/lists/*; \  | 
 | 213 | +# 	\  | 
 | 214 | +# 	rm -v /usr/local/bin/java; \  | 
 | 215 | +# 	\  | 
 | 216 | +# # ca-certificates-java does not work on src:openjdk-11: (https://bugs.debian.org/914424, https://bugs.debian.org/894979, https://salsa.debian.org/java-team/ca-certificates-java/commit/813b8c4973e6c4bb273d5d02f8d4e0aa0b226c50#d4b95d176f05e34cd0b718357c532dc5a6d66cd7_54_56)  | 
 | 217 | +# 	keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /etc/ssl/certs/java/cacerts.jks -deststoretype JKS -srcstorepass changeit -deststorepass changeit -noprompt; \  | 
 | 218 | +# 	mv /etc/ssl/certs/java/cacerts.jks /etc/ssl/certs/java/cacerts; \  | 
 | 219 | +# 	/var/lib/dpkg/info/ca-certificates-java.postinst configure; \  | 
 | 220 | +# 	\  | 
 | 221 | +# # verify that "docker-java-home" returns what we expect  | 
 | 222 | +# 	[ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \  | 
 | 223 | +# 	\  | 
 | 224 | +# # update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java  | 
 | 225 | +# 	update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \  | 
 | 226 | +# # ... and verify that it actually worked for one of the alternatives we care about  | 
 | 227 | +# 	update-alternatives --query java | grep -q 'Status: manual'  | 
 | 228 | + | 
 | 229 | +# # see CA_CERTIFICATES_JAVA_VERSION notes above  | 
 | 230 | +# RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure  | 
 | 231 | + | 
 | 232 | +# # Go install  | 
 | 233 | + | 
 | 234 | +ENV GOLANG_VERSION 1.21.5  | 
 | 235 | + | 
 | 236 | +RUN set -eux; \  | 
 | 237 | +  apt-get update; \  | 
 | 238 | +  apt-get install -y --no-install-recommends wget; \  | 
 | 239 | +# this "case" statement is generated via "update.sh"  | 
 | 240 | +  dpkgArch="$(dpkg --print-architecture)"; \  | 
 | 241 | +  case "${dpkgArch##*-}" in \  | 
 | 242 | +    amd64) goRelArch='linux-amd64'; goRelSha256='e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e' ;; \  | 
 | 243 | +    armhf) goRelArch='linux-armv6l'; goRelSha256='837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe' ;; \  | 
 | 244 | +    arm64) goRelArch='linux-arm64'; goRelSha256='841cced7ecda9b2014f139f5bab5ae31785f35399f236b8b3e75dff2a2978d96' ;; \  | 
 | 245 | +    i386) goRelArch='linux-386'; goRelSha256='8f4dba9cf5c61757bbd7e9ebdb93b6a30a1b03f4a636a1ba0cc2f27b907ab8e1' ;; \  | 
 | 246 | +    ppc64el) goRelArch='linux-ppc64le'; goRelSha256='907b8c6ec4be9b184952e5d3493be66b1746442394a8bc78556c56834cd7c38b' ;; \  | 
 | 247 | +    s390x) goRelArch='linux-s390x'; goRelSha256='9c4a81b72ebe44368813cd03684e1080a818bf915d84163abae2ed325a1b2dc0' ;; \  | 
 | 248 | +    *) goRelArch='src'; goRelSha256='285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19'; \  | 
 | 249 | +      echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \  | 
 | 250 | +  esac; \  | 
 | 251 | +  \  | 
 | 252 | +  url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \  | 
 | 253 | +  wget -O go.tgz "$url"; \  | 
 | 254 | +  echo "${goRelSha256} *go.tgz" | sha256sum -c -; \  | 
 | 255 | +  tar -C /usr/local -xzf go.tgz; \  | 
 | 256 | +  rm go.tgz; \  | 
 | 257 | +  \  | 
 | 258 | +  if [ "$goRelArch" = 'src' ]; then \  | 
 | 259 | +    echo >&2; \  | 
 | 260 | +    echo >&2 'error: UNIMPLEMENTED'; \  | 
 | 261 | +    echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \  | 
 | 262 | +    echo >&2; \  | 
 | 263 | +    exit 1; \  | 
 | 264 | +  fi; \  | 
 | 265 | +  \  | 
 | 266 | +  export PATH="/usr/local/go/bin:$PATH"; \  | 
 | 267 | +  go version  | 
 | 268 | + | 
 | 269 | +ENV GOPATH /go  | 
 | 270 | +ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH  | 
 | 271 | + | 
 | 272 | + | 
 | 273 | +# ENV RUSTUP_HOME=/usr/local/rustup \  | 
 | 274 | +#     CARGO_HOME=/usr/local/cargo \  | 
 | 275 | +#     PATH=/usr/local/cargo/bin:$PATH \  | 
 | 276 | +#     RUST_VERSION=1.46.0  | 
 | 277 | + | 
 | 278 | +# RUN set -eux; \  | 
 | 279 | +#     apt-get update; \  | 
 | 280 | +#     apt-get install -y --no-install-recommends \  | 
 | 281 | +#         ca-certificates \  | 
 | 282 | +#         gcc \  | 
 | 283 | +#         libc6-dev \  | 
 | 284 | +#         wget \  | 
 | 285 | +#         ; \  | 
 | 286 | +#     dpkgArch="$(dpkg --print-architecture)"; \  | 
 | 287 | +#     case "${dpkgArch##*-}" in \  | 
 | 288 | +#         amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='ad1f8b5199b3b9e231472ed7aa08d2e5d1d539198a15c5b1e53c746aad81d27b' ;; \  | 
 | 289 | +#         armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='6c6c3789dabf12171c7f500e06d21d8004b5318a5083df8b0b02c0e5ef1d017b' ;; \  | 
 | 290 | +#         arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='26942c80234bac34b3c1352abbd9187d3e23b43dae3cf56a9f9c1ea8ee53076d' ;; \  | 
 | 291 | +#         i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='27ae12bc294a34e566579deba3e066245d09b8871dc021ef45fc715dced05297' ;; \  | 
 | 292 | +#         *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \  | 
 | 293 | +#     esac; \  | 
 | 294 | +#     url="https://static.rust-lang.org/rustup/archive/1.21.1/${rustArch}/rustup-init"; \  | 
 | 295 | +#     wget "$url"; \  | 
 | 296 | +#     echo "${rustupSha256} *rustup-init" | sha256sum -c -; \  | 
 | 297 | +#     chmod +x rustup-init; \  | 
 | 298 | +#     ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \  | 
 | 299 | +#     rm rustup-init; \  | 
 | 300 | +#     chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \  | 
 | 301 | +#     rustup --version; \  | 
 | 302 | +#     cargo --version; \  | 
 | 303 | +#     rustc --version; \  | 
 | 304 | +#     apt-get remove -y --auto-remove \  | 
 | 305 | +#         wget \  | 
 | 306 | +#         ; \  | 
 | 307 | +#     rm -rf /var/lib/apt/lists/*;  | 
 | 308 | +CMD ["/bin/bash"]  | 
0 commit comments