diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index be24f0b4d..0da41b789 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,16 @@ -FROM ubuntu:20.04 +FROM --platform=linux/amd64 ubuntu:20.04 + +ARG USERNAME=meshlab +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +ARG QT_VERSION=5.15.2 + +ENV PATH=/opt/qt/${QT_VERSION}/gcc_64/bin:$PATH +ENV LD_LIBRARY_PATH=/opt/qt/${QT_VERSION}/gcc_64/lib/ +ENV QT_PLUGIN_PATH=/opt/qt/${QT_VERSION}/gcc_64/plugins/ +ENV QML_IMPORT_PATH=/opt/qt/${QT_VERSION}/gcc_64/qml/ +ENV QML2_IMPORT_PATH=/opt/qt/${QT_VERSION}/gcc_64/qml/ RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install \ build-essential \ @@ -25,37 +37,45 @@ RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install \ libxcb-xinerama0-dev \ libxerces-c-dev \ libxkbcommon-x11-dev \ - ninja-build \ patchelf \ packagekit-gtk3-module \ + # to be removed python3 \ - python3-pip + python3-pip \ + unzip \ + wget RUN pip3 install aqtinstall -ARG QT=5.15.2 -ARG QT_HOST=linux -ARG QT_TARGET=desktop -RUN aqt install-qt -O /opt/qt ${QT_HOST} ${QT_TARGET} ${QT} - -ENV PATH=/opt/qt/${QT}/gcc_64/bin:$PATH -ENV LD_LIBRARY_PATH=/opt/qt/${QT}/gcc_64/lib/ -ENV QT_PLUGIN_PATH=/opt/qt/${QT}/gcc_64/plugins/ -ENV QML_IMPORT_PATH=/opt/qt/${QT}/gcc_64/qml/ -ENV QML2_IMPORT_PATH=/opt/qt/${QT}/gcc_64/qml/ +RUN aqt install-qt -O /opt/qt linux desktop ${QT_VERSION} && \ + pip3 uninstall -y aqtinstall && \ + apt-get -y remove python3-pip python3 # install latest cmake and embree -RUN apt purge --auto-remove cmake && \ - apt-get -y install wget && \ - wget -qO- "https://cmake.org/files/v3.19/cmake-3.19.2-Linux-x86_64.tar.gz" \ +RUN wget -qO- "https://cmake.org/files/v3.19/cmake-3.19.2-Linux-x86_64.tar.gz" \ | tar --strip-components=1 -xz -C /usr/local &&\ wget -qO- "https://github.com/embree/embree/releases/download/v4.3.2/embree-4.3.2.x86_64.linux.tar.gz" \ | tar -xz -C /usr/local && \ bash /usr/local/embree-vars.sh && \ - apt-get -y remove wget && \ + wget -q "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip" && \ + unzip -o ninja-linux.zip -d /usr/bin/ && \ + rm ninja-linux.zip && \ + chmod +x /usr/bin/ninja && \ + apt-get -y remove wget unzip && \ apt-get -y autoremove && \ apt-get -y clean && \ rm -rf /var/lib/apt/lists/* # Generating a universally unique ID for the Container -RUN dbus-uuidgen > /etc/machine-id \ No newline at end of file +RUN dbus-uuidgen > /etc/machine-id + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + # [Optional] Add sudo support. + && apt-get update \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME \ No newline at end of file diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 368981de0..b319c2ed2 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -3,11 +3,11 @@ After built meshlab in the container, you can run it, but you'll need to give it access to the X server. You can do this by running the following command in the host machine: ```bash -xhost +local:* +xhost +local:* # or xhost +local:docker ``` You can disable access to the X server later by running the following command in the host machine: ```bash -xhost -local:* +xhost -local:* # or xhost -local:docker ``` \ No newline at end of file