Dockerfile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. FROM ubuntu:latest
  2. LABEL maintainer="Kassapa"
  3. ENV DEBIAN_FRONTEND noninteractive
  4. # https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
  5. ARG PYTHON_VERSION=3.13
  6. RUN apt update
  7. RUN apt -y install lsb-release apt-utils \
  8. debian-keyring debian-archive-keyring apt-transport-https software-properties-common curl wget gnupg
  9. RUN add-apt-repository -y ppa:deadsnakes/ppa
  10. RUN apt -y upgrade
  11. RUN apt -y install git vim sudo locales locales-all tzdata build-essential \
  12. python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv
  13. RUN apt -y autoremove
  14. RUN apt -y clean
  15. RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
  16. RUN locale-gen
  17. RUN update-locale LANG=en_US.UTF-8
  18. RUN update-alternatives --set editor /usr/bin/vim.basic
  19. RUN useradd -s /bin/bash -m deploy
  20. RUN passwd -l deploy
  21. RUN echo 'deploy ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/101-deploy
  22. USER deploy
  23. RUN python${PYTHON_VERSION} -m venv $HOME/python3
  24. RUN echo 'source $HOME/python3/bin/activate' >> $HOME/.bashrc
  25. # https://pip.pypa.io/en/stable/installation/#get-pip-py
  26. ADD --chown=deploy https://bootstrap.pypa.io/get-pip.py /opt/
  27. RUN bash -c ". $HOME/python3/bin/activate && python3 /opt/get-pip.py"
  28. RUN bash -c ". $HOME/python3/bin/activate && pip install pika requests redis[hiredis] openai"
  29. # COPY --chown=deploy README.md pyproject.toml /opt/ai-translate/
  30. # COPY --chown=deploy ai_translate /opt/ai-translate/ai_translate
  31. # RUN bash -c "source $HOME/python3/bin/activate && python3 -m pip install -e /opt/ai-translate"
  32. RUN echo "$(date -u +%4Y%m%d%H%M%S)" | sudo tee /VERSION
  33. VOLUME /srv
  34. WORKDIR /srv
  35. CMD ["/bin/bash", "-l"]