|
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | + |
| 3 | +FROM ubuntu:focal |
| 4 | + |
| 5 | +ARG DEBIAN_FRONTEND=noninteractive |
| 6 | + |
| 7 | +RUN <<EOF |
| 8 | +apt-get update |
| 9 | +apt-get install -y ca-certificates |
| 10 | +rm -rf /var/lib/apt/lists/* |
| 11 | +EOF |
| 12 | + |
| 13 | +COPY <<EOF /etc/apt/sources.list |
| 14 | +deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse |
| 15 | +deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse |
| 16 | +deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse |
| 17 | +deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse |
| 18 | +EOF |
| 19 | + |
| 20 | +ENV TZ=Asia/Shanghai |
| 21 | + |
| 22 | +RUN <<EOF |
| 23 | +apt-get update |
| 24 | +apt-get install -y tzdata |
| 25 | +apt-get install -y locales && locale-gen en_US.UTF-8 |
| 26 | +apt-get install -y gosu |
| 27 | +rm -rf /var/lib/apt/lists/* |
| 28 | +EOF |
| 29 | + |
| 30 | +ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 |
| 31 | + |
| 32 | +# https://github.com/pyenv/pyenv/wiki#suggested-build-environment |
| 33 | +RUN <<EOF |
| 34 | +apt-get update |
| 35 | +apt-get install -y git |
| 36 | +apt-get install -y build-essential libssl-dev zlib1g-dev \ |
| 37 | + libbz2-dev libreadline-dev libsqlite3-dev curl \ |
| 38 | + libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev |
| 39 | +rm -rf /var/lib/apt/lists/* |
| 40 | +EOF |
| 41 | + |
| 42 | +ENV PYENV_ROOT="/usr/local/pyenv" |
| 43 | +ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH" |
| 44 | +ARG PYTHON_VERSION="3.10" |
| 45 | +# https://github.com/pyenv/pyenv/pull/2592 |
| 46 | +# https://github.com/pyenv/pyenv/wiki#how-to-build-cpython-for-maximum-performance |
| 47 | +ARG PYTHON_CONFIGURE_OPTS="--disable-shared --enable-optimizations --with-lto" |
| 48 | +ARG PYTHON_CFLAGS="-march=native -mtune=native" |
| 49 | + |
| 50 | +RUN <<EOF |
| 51 | +curl https://pyenv.run | bash |
| 52 | +pyenv install $PYTHON_VERSION |
| 53 | +pyenv global $PYTHON_VERSION |
| 54 | +EOF |
| 55 | + |
| 56 | +RUN <<EOF |
| 57 | +python -m pip install --no-cache-dir --upgrade pip |
| 58 | +pip install --no-cache-dir nuitka |
| 59 | +EOF |
| 60 | + |
| 61 | +RUN <<EOF |
| 62 | +apt-get update |
| 63 | +apt-get install -y ccache patchelf |
| 64 | +rm -rf /var/lib/apt/lists/* |
| 65 | +EOF |
| 66 | + |
| 67 | +WORKDIR /code |
| 68 | + |
| 69 | +COPY docker-entrypoint.sh /usr/local/bin/ |
| 70 | +ENTRYPOINT ["docker-entrypoint.sh"] |
| 71 | +COPY docker-cmd.sh /usr/local/bin/ |
| 72 | +CMD ["docker-cmd.sh"] |
0 commit comments