Skip to content

Commit

Permalink
update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Jul 19, 2024
1 parent dc73385 commit f213162
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
56 changes: 38 additions & 18 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
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
4 changes: 2 additions & 2 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit f213162

Please sign in to comment.