Skip to content

Docker issues #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed

Docker issues #104

wants to merge 22 commits into from

Conversation

zerdos
Copy link

@zerdos zerdos commented Mar 7, 2019

  • add .dockerignore files
  • instead of parallel execution, use sequential one (to avoid async errors)
  • use locked yarn files (otherwise, we can't be sure which version will be installed)
  • use the same node version what we are using on Travis

@zerdos
Copy link
Author

zerdos commented Mar 7, 2019

I uploaded an image to dockerhub, which was built from my branch, by dockerhub:
https://hub.docker.com/r/zerdos/vscode-server/tags

@zerdos zerdos closed this Mar 7, 2019
@zerdos zerdos reopened this Mar 7, 2019
@nhooyr
Copy link
Contributor

nhooyr commented Mar 7, 2019

use the same node version what we are using on Travis

Lets upgrade the travis version instead @kylecarbs

#110

instead of parallel execution, use sequential one (to avoid async errors)

Lets just do #100

use locked yarn files (otherwise, we can't be sure which version will be installed)

This is a solid change.

add .dockerignore files

This is a good change too.

Dockerfile
lib
node_modules
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want to not put node_modules into the container?

Right now yarn doesn't use it as a cache but it could in the future. See the comment in the Dockerfile.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we can add it back later.

Copy link
Author

Choose a reason for hiding this comment

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

https://medium.com/@rdsubhas/docker-for-development-common-problems-and-solutions-95b25cae41eb

In linux we have linux binaries, on mac we have mac binaries, on windows we have exe files.

NPM is a hot mess, so node_modules should be git + docker ignored.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure about this? I thought node_modules only contained source code? Not actual binaries.

Copy link
Contributor

Choose a reason for hiding this comment

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

@zerdos is right. Check the folder node_modules/.bin/. There are modules that build executables in there (the node-sass package is one that comes to mind. I don't think code-server uses it, but there are many other examples).

yarn.lock Outdated
@@ -27,172 +27,175 @@
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this file have so many changes?

@@ -14,6 +14,7 @@
},
"devDependencies": {
"@types/tar-stream": "^1.6.0",
"cross-env": "^5.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

@kylecarbs why wasn't this here already?

Copy link
Author

Choose a reason for hiding this comment

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

I've seen a commit yesterday, which removed the global instal of this packet from travis.
I think you guys have this package installed globally :)

Copy link
Member

@code-asher code-asher Mar 8, 2019

Choose a reason for hiding this comment

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

This should be fixed now (71abb8d); the scripts directly reference the cross-env binary installed in the root node_modules directory.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 7, 2019

@zerdos instead of opening multiple PRs, in the future please edit the existing PR.

Dockerfile Outdated
@@ -1,32 +1,47 @@
FROM node:8.9.3
FROM node:8.15.1
Copy link
Contributor

Choose a reason for hiding this comment

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

8.15.1 will not build as nexe does not support it.

https://github.com/nexe/nexe/releases

@zerdos
Copy link
Author

zerdos commented Mar 7, 2019

Removed the yarn.lock file changes, also the other non version bumps.

...and it seems the docker build is still working :)

Dockerfile Outdated
@@ -11,7 +11,7 @@ RUN npm install -g yarn
# directly which should be faster.
WORKDIR /src
COPY . .
RUN yarn
RUN yarn --forzen-lockfile
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be --frozen-lockfile

Copy link

@mko-x mko-x left a comment

Choose a reason for hiding this comment

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

I would do some minor changes as you can see t the different comments.

So far so good - but the serial manual execution of the yarn jobs is no good.

**/dist
**/out
.DS_Store
*.DS_Store
Copy link

Choose a reason for hiding this comment

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

why an additional starred .DS_Store?
it is not necessary

Suggested change
*.DS_Store

.DS_Store
*.DS_Store
release
**/yarn-error.log
Copy link

Choose a reason for hiding this comment

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

Shouldn't any logs be ignored?

Suggested change
**/yarn-error.log
**/*.log

@@ -4,3 +4,4 @@ dist
out
.DS_Store
release
yarn-error.log
Copy link

Choose a reason for hiding this comment

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

Same as with .dockerignore, all log-files should be ignored

Suggested change
yarn-error.log
**/*.log

"packages:install": "cd ./packages && yarn",
"postinstall": "npm-run-all --parallel packages:install build:rules",
"packages:install": "cd ./packages && yarn --frozen-lockfile",
"postinstall": "npm-run-all packages:install build:rules",
Copy link
Contributor

Choose a reason for hiding this comment

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

I want a rationale why the parallel flag have to be removed.

@zerdos
Copy link
Author

zerdos commented Mar 16, 2019

I wasn't able to run a successful build without this.
Yes, its slower and less efficient, but at least running, after a fresh checkout.

@sr229
Copy link
Contributor

sr229 commented Mar 16, 2019

Unfortunately this is a cherry pick not a merge, I don't think that Dockerfile is a pass even for me. It's way too many layers for a build step whoch won't be used anyways. Practice Layer optimization please.

@zerdos
Copy link
Author

zerdos commented Mar 16, 2019

The end result will be small (2 stages build).

Those yarn commands could be on one layer for sure, but the build should be sequential - its not running with the parallel execution task unfortunately after a fresh checkout.

The biggest difference in the PR, that I put the node_modules directories to the .dockerignore.

Btw, on my laptop (mac environment) I never managed to run a successful build from the master branch.

@zerdos zerdos closed this Mar 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants