diff --git a/docker/tool/linux/Dockerfile b/docker/tool/linux/Dockerfile index 14bd8d59..6bcfd1d6 100644 --- a/docker/tool/linux/Dockerfile +++ b/docker/tool/linux/Dockerfile @@ -1,12 +1,7 @@ FROM iotedgedev-linux-base ARG IOTEDGEDEV_VERSION COPY iotedgedev-$IOTEDGEDEV_VERSION-py2.py3-none-any.whl dist/iotedgedev-$IOTEDGEDEV_VERSION-py2.py3-none-any.whl -RUN pip install dist/iotedgedev-$IOTEDGEDEV_VERSION-py2.py3-none-any.whl -RUN export LC_ALL=C.UTF-8 && \ - export LANG=C.UTF-8 - -RUN useradd -m iotedgedev && \ - echo 'iotedgedev ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ - chown -R iotedgedev:iotedgedev . - -USER iotedgedev \ No newline at end of file +RUN sudo -H pip3 install dist/iotedgedev-$IOTEDGEDEV_VERSION-py2.py3-none-any.whl && \ + sudo rm -rf dist/ +ENV LC_ALL C.UTF-8 +ENV LANG C.UTF-8 \ No newline at end of file diff --git a/docker/tool/linux/Dockerfile.base b/docker/tool/linux/Dockerfile.base index 87ca2d7f..7fc9fa2e 100644 --- a/docker/tool/linux/Dockerfile.base +++ b/docker/tool/linux/Dockerfile.base @@ -27,18 +27,26 @@ RUN AZ_REPO=$(lsb_release -cs) && \ tee /etc/apt/sources.list.d/azure-cli.list && \ apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893 && \ apt-get update && apt-get install azure-cli -RUN apt-get update && az extension add --name azure-cli-iot-ext && \ +RUN apt-get update && \ npm i npm@latest -g && \ npm i -g iothub-explorer yo generator-azure-iot-edge-module && \ apt-get install -y --no-install-recommends python-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev sudo && \ rm -rf /var/lib/apt/lists/* -RUN python -m pip install --upgrade pip && \ - alias python=python3 && \ - alias pip=pip3 && \ - python -m pip install --upgrade pip && \ - pip install setuptools && \ - pip install cookiecutter +RUN python3 -m pip install --upgrade pip && \ + pip3 install setuptools && \ + pip3 install cookiecutter WORKDIR /home/iotedge COPY install-dev.sh /scripts/install-dev.sh RUN sed -i 's/\r//' /scripts/install-dev.sh + +# Switch to a non-root user because Yeoman does not work root with users +# https://github.com/Azure/iotedgedev/issues/312 +RUN useradd -m iotedgedev && \ + echo 'iotedgedev ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ + chown -R iotedgedev:iotedgedev /home/iotedge +USER iotedgedev +# Azure CLI extensions are installed per user +RUN az extension add --name azure-cli-iot-ext && \ + echo 'alias python=python3' >> ~/.bashrc && \ + echo 'alias pip=pip3' >> ~/.bashrc ENV DEBIAN_FRONTEND teletype \ No newline at end of file