Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

theia-full-docker: include Rust + rls #50

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions theia-full-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:16.04
FROM ubuntu:18.04

#Common deps
RUN apt-get update && apt-get -y install curl xz-utils
RUN apt-get update && apt-get -y install curl xz-utils gnupg

#Install node and yarn
#From: https://github.com/nodejs/docker-node/blob/6b8d86d6ad59e0d1e7a94cec2e909cad137a028f/8/Dockerfile
Expand Down Expand Up @@ -110,6 +110,13 @@ RUN ln -s /usr/bin/clangd-6.0 /usr/bin/clangd
RUN apt-get update && apt-get install -y python python-pip
RUN pip install python-language-server

#Rust
RUN curl https://sh.rustup.rs -sSf > /tmp/rustup.sh
RUN chmod +x /tmp/rustup.sh && /tmp/rustup.sh -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When building the image on my Ubuntu 16.04 machine, I get the following error:

Step 41/53 : RUN chmod +x /tmp/rustup.sh && /tmp/rustup.sh -y
 ---> Running in 73694bf1a4f1
/bin/sh: 1: /tmp/rustup.sh: Text file busy
The command '/bin/sh -c chmod +x /tmp/rustup.sh && /tmp/rustup.sh -y' returned a non-zero code: 2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the line with RUN /bin/sh /tmp/rustup.sh -y seems to work for me.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how there could be a difference here, unless something changed in the base image and you have an older base image cached.

I'm using this Dockerfile currently, without issue. Further, I can't imagine a script that /bin/sh could run that /bin/bash (presumably the default in Ubuntu) couldn't run.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue I encountered may be this one: moby/moby#9547

Nothing wrong as such with your version - technically it should work just as well. However the issue I reported happened consistently on my work laptop. The same Dockerfile builds fine on my (much faster) home desktop. According to the link above, it may be linked to the aufs storage driver. I do not remember if that's used on my work laptop, but it's not on my desktop, so that may be a factor.

unless something changed in the base image and you have an older base image cached

This image is self-contained and doesn't derive from the base image. I used --no-cache when building to make sure it was a clean build.

I can't imagine a script that /bin/sh could run that /bin/bash (presumably the default in Ubuntu) couldn't run.

looks like docker is using /bin/sh, so I used the same. from the error message: /bin/sh: 1: /tmp/rustup.sh: Text file busy. My goal was to avoid having to use chmod before executing the file, thus reducing the two commands to one.

Using a sync between the chmod and script execution may be an alternative: moby/moby#9547 (comment)

This user has a theory about what's happening: moby/moby#9547 (comment)

ENV PATH=$PATH:/root/.cargo/bin
RUN rustup update
RUN rustup component add rls-preview rust-analysis rust-src

#Theia
##Needed for node-gyp, nsfw build
RUN apt-get update && apt-get install -y python build-essential
Expand All @@ -122,4 +129,7 @@ RUN yarn --cache-folder ./ycache && rm -rf ./ycache
RUN yarn theia build
EXPOSE 3000
ENV SHELL /bin/bash

RUN apt-get update && apt-get install -y pkg-config gettext libssl-dev

ENTRYPOINT [ "yarn", "theia", "start", "/home/project", "--hostname=0.0.0.0" ]
2 changes: 1 addition & 1 deletion theia-full-docker/next.package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"private": true,
"dependencies": {
"typescript": "latest",
"@theia/core": "next",
"@theia/cpp": "next",
"@theia/editor": "next",
"@theia/extension-manager": "next",
Expand All @@ -21,6 +20,7 @@
"@theia/preferences": "next",
"@theia/process": "next",
"@theia/python": "next",
"@theia/rust": "next",
"@theia/terminal": "next",
"@theia/typescript": "next",
"@theia/userstorage": "next",
Expand Down
27 changes: 27 additions & 0 deletions theia-full-docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
set -x

docker build \
--nocache \
--tag docker.io/colemickens/theia \
--build-arg version=next \
.

docker run -it \
--volume /home/cole/code:/code \
--volume /home/cole/.gitconfig:/root/.gitconfig \
--volume /home/cole/.theia:/root/.theia \
--volume /home/cole/.cargo/registry:/root/.cargo/registry \
--volume /home/cole/.go:/root/.go \
--volume /etc/nixcfg:/nixcfg \
--volume /etc/nixpkgs:/nixpkgs \
--publish 0.0.0.0:1111:1111 \
--publish 0.0.0.0:3000:3000 \
--publish 0.0.0.0:5555:5555 \
--publish 0.0.0.0:5556:5556 \
docker.io/colemickens/theia

exit

# --env GOPATH=/code \