tvid/Dockerfile

112 lines
3.4 KiB
Docker
Raw Normal View History

2020-03-10 13:44:28 +00:00
# focal amd64 as of 2020-03-10
FROM ubuntu@sha256:d050ed7278c16ff627e4a70d7d353f1a2ec74d8a0b66e5a865356d92f5f6d87b
2020-03-11 01:52:30 +00:00
################################################################################
2020-03-10 13:44:28 +00:00
## Mirror Setup
## - option to use local mirror to speed build
2020-03-11 01:52:30 +00:00
################################################################################
2020-03-10 13:44:28 +00:00
ARG UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu
2020-03-11 01:52:30 +00:00
RUN echo "deb $UBUNTU_MIRROR focal main universe restricted multiverse" > \
/etc/apt/sources.list.new && \
echo "deb $UBUNTU_MIRROR focal-updates main universe restricted multiverse" >> \
/etc/apt/sources.list.new && \
echo "deb $UBUNTU_MIRROR focal-security main universe restricted multiverse" >> \
/etc/apt/sources.list.new && \
echo "deb $UBUNTU_MIRROR focal-backports main universe restricted multiverse" >> \
/etc/apt/sources.list.new && \
mv /etc/apt/sources.list.new /etc/apt/sources.list
2020-03-10 13:44:28 +00:00
2020-03-11 01:52:30 +00:00
ARG UID=61000
ARG GID=61000
RUN groupadd \
--system --gid $GID \
app && \
useradd \
--system --gid $GID --uid $UID \
--no-log-init -m -s /bin/false --home-dir /home/app \
app
################################################################################
2020-03-10 13:44:28 +00:00
## Versions
2020-03-11 01:52:30 +00:00
################################################################################
2020-03-10 13:44:28 +00:00
# master as of 2020-03-10
ARG PYENV_COMMIT=df9fa1dc30b6448ef8605e2c2d4dfc2a94d6a35d
ARG PYTHON_VERSION=3.8.1
2020-03-11 01:52:30 +00:00
################################################################################
2020-03-10 13:44:28 +00:00
## Packages
2020-03-11 01:52:30 +00:00
################################################################################
2020-03-10 13:44:28 +00:00
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt upgrade -y && \
apt install -y \
build-essential \
curl \
git \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
llvm \
locales \
2020-03-11 01:52:30 +00:00
locales \
2020-03-10 13:44:28 +00:00
make \
python-openssl \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
&& \
2020-03-11 01:52:30 +00:00
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8 && \
2020-03-10 13:44:28 +00:00
mkdir -p /var/app && \
2020-03-11 01:52:30 +00:00
chown app:app /var/app
2020-03-10 13:44:28 +00:00
2020-03-11 01:52:30 +00:00
ENV LANG en_US.UTF-8
2020-03-10 13:44:28 +00:00
2020-03-11 01:52:30 +00:00
USER app
WORKDIR /home/app
ENV HOME /home/app
2020-03-10 13:44:28 +00:00
2020-03-11 01:52:30 +00:00
RUN git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv && \
cd $HOME/.pyenv && \
git checkout $PYENV_COMMIT
ENV PYENV_ROOT $HOME/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
################################################################################
2020-03-10 13:44:28 +00:00
## Python
2020-03-11 01:52:30 +00:00
################################################################################
2020-03-10 13:44:28 +00:00
RUN pyenv install $PYTHON_VERSION && \
2020-03-11 01:52:30 +00:00
pyenv global $PYTHON_VERSION && \
pyenv rehash && \
pip install --upgrade pip && \
pip install pipenv
2020-03-10 13:44:28 +00:00
2020-03-11 01:52:30 +00:00
################################################################################
## Install App Deps
################################################################################j
2020-03-10 13:44:28 +00:00
WORKDIR /var/app
2020-03-11 01:52:30 +00:00
COPY ./Pipfile ./Pipfile.lock /var/app/
RUN pipenv install --python $PYENV_ROOT/shims/python
2020-03-10 13:44:28 +00:00
2020-03-11 01:52:30 +00:00
################################################################################
2020-03-10 13:44:28 +00:00
## Install App
2020-03-11 01:52:30 +00:00
################################################################################
COPY . /var/app
VOLUME /data
ENV PYTHONPATH /var/app
CMD pipenv run python ./bin/tvidd