Skip to content

Instantly share code, notes, and snippets.

@BlackHacked
Forked from delagreen-v2/Dockerfile
Created May 13, 2025 03:50
Show Gist options
  • Save BlackHacked/cbdc4999a7cfe7c137bef1d71bb1ae7d to your computer and use it in GitHub Desktop.
Save BlackHacked/cbdc4999a7cfe7c137bef1d71bb1ae7d to your computer and use it in GitHub Desktop.
Dockerfile
FROM ubuntu:20.04
USER root
WORKDIR /root
SHELL [ "/bin/bash", "-c" ]
ARG PYTHON_VERSION_TAG=3.10.5
ARG LINK_PYTHON_TO_PYTHON3=1
# Existing lsb_release causes issues with modern installations of Python3
# https://github.com/pypa/pip/issues/4924#issuecomment-435825490
# Set (temporarily) DEBIAN_FRONTEND to avoid interacting with tzdata
RUN apt-get -qq -y update && \
apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
apt-utils\
gcc \
g++ \
zlibc \
zlib1g-dev \
libssl-dev \
libbz2-dev \
libsqlite3-dev \
libncurses5-dev \
libgdbm-dev \
libgdbm-compat-dev \
liblzma-dev \
libreadline-dev \
uuid-dev \
libffi-dev \
tk-dev \
wget \
curl \
git \
make \
sudo \
bash-completion \
tree \
nano\
vim \
software-properties-common \
xvfb \
libxkbcommon0 \
libxcb-xinerama0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-util1 \
libxcb-xkb1 \
qt5-default && \
# build-essential \
# libdbus-1-3 \
# libpulse-mainloop-glib0\
mv /usr/bin/lsb_release /usr/bin/lsb_release.bak && \
apt-get -y autoclean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*
COPY install_python.sh install_python.sh
RUN bash install_python.sh ${PYTHON_VERSION_TAG} ${LINK_PYTHON_TO_PYTHON3} && \
rm -r install_python.sh Python-${PYTHON_VERSION_TAG}
# Enable tab completion by uncommenting it from /etc/bash.bashrc
# The relevant lines are those below the phrase "enable bash completion in interactive shells"
RUN export SED_RANGE="$(($(sed -n '\|enable bash completion in interactive shells|=' /etc/bash.bashrc)+1)),$(($(sed -n '\|enable bash completion in interactive shells|=' /etc/bash.bashrc)+7))" && \
sed -i -e "${SED_RANGE}"' s/^#//' /etc/bash.bashrc && \
unset SED_RANGE
# Create user "docker" with sudo powers
RUN useradd -m docker && \
usermod -aG sudo docker && \
echo '%sudo ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
cp /root/.bashrc /home/docker/ && \
mkdir /home/docker/data && \
chown -R --from=root docker /home/docker
# Use C.UTF-8 locale to avoid issues with ASCII encoding
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
WORKDIR /home/docker/data
ENV HOME /home/docker
ENV USER docker
USER docker
ENV PATH /home/docker/.local/bin:$PATH
# Avoid first use of sudo warning. c.f. https://askubuntu.com/a/22614/781671
RUN touch $HOME/.sudo_as_admin_successful
#Install dependencies
#COPY requirements.txt requirements.txt
#RUN pip3 install -r requirements.txt
#Install addons
##https://www.opendesign.com/guestfiles/oda_file_converter
#COPY /addons/ODAFileConverter_QT6_lnxX64_8.3dll_25.4.AppImage ODAFileConverter_QT6_lnxX64_8.3dll_25.4.AppImage
COPY /addons/ODAFileConverter_QT6_lnxX64_8.3dll_25.4.deb ODAFileConverter_QT6_lnxX64_8.3dll_25.4.deb
COPY /addons/requirements.txt requirements.txt
COPY /addons/main.py main.py
COPY /addons/test.tar.gz test.tar.gz
##https://ezdxf.readthedocs.io/en/stable/options.html#config-files
#RUN chmod ugo+x ~/data/ODAFileConverter.AppImage
#RUN ./ODAFileConverter_QT6_lnxX64_8.3dll_25.4.AppImage
RUN tar -zxvf test.tar.gz
RUN pip3 install -r requirements.txt
# Install ODA DWG-DXF Converter
RUN sudo dpkg --install ODAFileConverter_QT6_lnxX64_8.3dll_25.4.deb
#|| true
CMD [ "/bin/bash" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment