Conversation
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
|
This PR uses It is open for discussions. |
|
hello, could you clarify the 'uneeded user' ? |
|
Maybe we should use next with hash commit instead of next version? |
|
@benoitf Yes. I see no pint in having it in the image. I've just checked it on docker and openshift with machines extension - and it works fine (with |
|
when you say "openshift", is it openshift.io ? |
|
It is local ocp |
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
dockerfiles/theia/Dockerfile
Outdated
| rm -rf /tmp/* /var/cache/apk/* | ||
|
|
||
| # Packages which will be included into default build of Theia | ||
| ADD theia-default-package.json ${HOME}/package.json |
There was a problem hiding this comment.
as we're adding all files into ${HOME}
maybe we could use a single ADD instruction for everything that goes into /home/theia
(instead of one for package.json, one for versions.sh, one for add-extensions.js and one for start.sh
we could have folders like
src/home/theia --> /home/theia
src/etc/ ---> /etc/
There was a problem hiding this comment.
To me it is better to keep it as is because that ADD instructions appears when target file is needed. For example:
ADD src/versions.sh ${HOME}/versions.sh
RUN ${HOME}/versions.sh && rm ${HOME}/versions.sh
We add, use and finally remove file. No need to search whole dockerfile and think about context (who else could use or modify or require it).
There was a problem hiding this comment.
It adds useless extra lines/layers
if you store files in dedicated folders then you're expecting their location inside the image so reading the Dockerfile is easier. And of course, you don't need to bother where this file has been added.
Also note that the file that you're removing is not also really removed from layers.
|
I updated this PR. Tested on docker and openshift.io. |
dockerfiles/theia/Dockerfile
Outdated
| WORKDIR ${HOME} | ||
| ADD supervisord.conf /etc/ | ||
| ADD src/start.sh ${HOME}/start.sh | ||
| RUN touch /var/log/supervisord.log && chmod g+rwX /var/log/supervisord.log && chgrp 0 /var/log/supervisord.log |
There was a problem hiding this comment.
RUN instruction should be appended to the previous
There was a problem hiding this comment.
I think it will impact how easy to read this dockerfile is. But ok, I'll move it.
There was a problem hiding this comment.
@mmorhun I would say that workspace should start as fast as possible (minimal set of layers, best size as possible)
dockerfiles/theia/Dockerfile
Outdated
| # ==TODO== add after generator-theia-plugin release | ||
| # npm install -g yo @wiptheia/generator-theia-plugin | ||
| # Change permissions to allow editing of files for openshift user | ||
| RUN find ${HOME} -exec sh -c "chgrp 0 {}; chmod g+rwX {}" \; |
There was a problem hiding this comment.
RUN instruction should be merged with the previous RUN instruction
having two RUN instructions with one changing permission is duplicating the layer for nothing
benoitf
left a comment
There was a problem hiding this comment.
image is almost 1GB, IMHO there are layers that need to be skipped
|
@mmorhun I'd combine all RUN instructions if possible and have one ADD instruction that adds all files and scripts to one directory from which you can then consume them in a Dockerfile |
dockerfiles/theia/Dockerfile
Outdated
| USE_LOCAL_GIT=true \ | ||
| HOME=/home/theia | ||
|
|
||
| RUN apk update && apk add --no-cache make gcc g++ python git openssh bash supervisor jq && \ |
There was a problem hiding this comment.
on a side note, I notice that you're installing openssh but can we really connect through ssh ?
There was a problem hiding this comment.
Yeah, good catch. It is result of merge. Will remove it.
|
on a side note, is it possible to make GITHUB_TOKEN optional ? |
|
No, it is not mandatory. One could provide it as a build arg. |
|
@mmorhun (it's like it provides an empty value token) |
|
@benoitf this is a known limitation of Theia |
|
@eivantsov I don't see how it's a limitation of theia ? I can clone theia, build theia and run theia without defining GITHUB_TOKEN What I wanted was:
|
|
Yes, Theia will use an empty token and build may be a success unless you hit access rate on Github. At least it worked for me this way. Everyone had such an issue when building Theia. Once the entire office started building Theia and we quickly hit the limit from one IP. Btw, do we still need GITHUB_TOKEN after eclipse-theia/theia#2091? |
|
@eivantsov seems yes. I've tried |
|
We may remove GitHub token arg, but this way there are NO guarantees that the image build won't fail in CI. |
|
@eivantsov @mmorhun my problem is not with providing GITHUB_TOKEN which is working fine |
|
@benoitf I don't know a good way to know in advance if or not As the image is built mostly by CI it wasn't a problem. If you have a better way to build Theia and make one of its components not to download anything from GitHub, we will all appreciate it. |
|
|
|
BTW I'm not trying to argue that GITHUB_TOKEN is a bad idea and that it doesn't solve an issue. just that it seems it's forcing ppl to give that parameter even if they don't require it. with |
|
Thanks so much. This will of course add complexity to a Dockerfile. An additional script? |
|
yes maybe we can split long RUN instructions to small shell scripts to be more readable. I'm fine with all solutions as long as I may not be forced to give GITHUB_TOKEN if not required |
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
|
So, we can split it, but I added comments to the sections and finally it doesn't look huge and unreadable. |
dockerfiles/theia/Dockerfile
Outdated
| # Add Theia extensions | ||
| #==TODO== replace with Eclipse official version after Theia release | ||
| #git clone https://github.com/eclipse/che-theia-hosted-plugin-manager-extension /tmp/hosted-plugin-extension && \ | ||
| git clone https://github.com/mmorhun/che-theia-hosted-plugin-manager-extension /tmp/hosted-plugin-extension && \ |
There was a problem hiding this comment.
what is the difference between mmorhun/che-theia-hosted-plugin-manager-extension and https://github.com/eclipse/che-theia-hosted-plugin-manager-extension ? could it just be a branch of main repo ?
| yarn theia build && \ | ||
| # Install Theia plugin generator | ||
| #==TODO== add after generator-theia-plugin release | ||
| #npm install -g yo @wiptheia/generator-theia-plugin && \ |
There was a problem hiding this comment.
you think we shouldn't include the wip package for now ?
There was a problem hiding this comment.
I think we need release it first. Do not want to download wiptheia core and stuff.
There was a problem hiding this comment.
ah yes I forgot to push changes that use @theia/plugin
let's keep commented as you made 👍
dockerfiles/theia/Dockerfile
Outdated
| # Grant permissions for modifying supervisor log file | ||
| touch /var/log/supervisord.log && chmod g+rwX /var/log/supervisord.log && chgrp 0 /var/log/supervisord.log | ||
|
|
||
| WORKDIR ${HOME} |
There was a problem hiding this comment.
(not important) could we move WORKDIR at the top of the file before RUN instruction so we can reuse that layer every time
| ARG THEIA_VERSION=0.3.10 | ||
| ENV USE_LOCAL_GIT=true \ | ||
| GITHUB_TOKEN=${GITHUB_TOKEN} \ | ||
| ARG THEIA_VERSION=0.4.0-next.b17727c1 |
There was a problem hiding this comment.
why using a specific version of next instead of next ?
we may want to include all upstream theia fixes on nightlies
There was a problem hiding this comment.
So you want to use next?
There was a problem hiding this comment.
Just to be sure we have working image (I tested it on both docker and oso infras)
There was a problem hiding this comment.
It will be confused when we move back to the strict Theia version, but dockerhub save "next" tag. @benoitf What do you think? Somebody can try to use it, but it won't be next any more. And if we have next tag we should update it every night.
There was a problem hiding this comment.
@AndrienkoAleksandr I would think to have a real "nightly" based on "next" and a fixed version as suggested by @mmorhun
benoitf
left a comment
There was a problem hiding this comment.
we can merge and iterate later on the changes
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
|
FYI I created #10205 for improvements |
|
Thanks |
…10148) * CHE-10124: Merge wiptheia dockerfile with Che Theia IDE dockerfile Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun mmorhun@redhat.com
What does this PR do?
Combines features of witheia docker image with Che one.
Removes unneeded user and
sudofrom the image.Drops support for Theia extensions vie env variable. Now thay must be added on docker image build phase.
What issues does this PR fix or reference?
#10124