Skip to content

Docker issues#104

Closed
zerdos wants to merge 22 commits into
coder:masterfrom
zerdos:docker
Closed

Docker issues#104
zerdos wants to merge 22 commits into
coder:masterfrom
zerdos:docker

Conversation

@zerdos

@zerdos zerdos commented Mar 7, 2019

Copy link
Copy Markdown
  • 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

zerdos commented Mar 7, 2019

Copy link
Copy Markdown
Author

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

nhooyr commented Mar 7, 2019

Copy link
Copy Markdown
Contributor

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.

Comment thread .dockerignore
.gitignore
Dockerfile
lib
node_modules

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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).

Comment thread build/tasks.ts Outdated
Comment thread yarn.lock
@@ -27,172 +27,175 @@
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

Copy link
Copy Markdown
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?

Comment thread scripts/install-packages.ts
},
"devDependencies": {
"@types/tar-stream": "^1.6.0",
"cross-env": "^5.2.0",

Copy link
Copy Markdown
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
Copy Markdown
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 :)

@code-asher code-asher Mar 8, 2019

Copy link
Copy Markdown
Member

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

nhooyr commented Mar 7, 2019

Copy link
Copy Markdown
Contributor

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

Comment thread Dockerfile Outdated
@@ -1,32 +1,47 @@
FROM node:8.9.3
FROM node:8.15.1

Copy link
Copy Markdown
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

zerdos commented Mar 7, 2019

Copy link
Copy Markdown
Author

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

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

Comment thread Dockerfile Outdated
WORKDIR /src
COPY . .
RUN yarn
RUN yarn --forzen-lockfile

Copy link
Copy Markdown
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

Comment thread Dockerfile

@mko-x mko-x left a comment

Copy link
Copy Markdown

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.

Comment thread .dockerignore
**/dist
**/out
.DS_Store
*.DS_Store

Copy link
Copy Markdown

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

Comment thread .dockerignore
.DS_Store
*.DS_Store
release
**/yarn-error.log

Copy link
Copy Markdown

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

Comment thread .gitignore
out
.DS_Store
release
yarn-error.log

Copy link
Copy Markdown

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

Comment thread Dockerfile
Comment thread Dockerfile
Comment thread package.json
"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
Copy Markdown
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

zerdos commented Mar 16, 2019

Copy link
Copy Markdown
Author

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

sr229 commented Mar 16, 2019

Copy link
Copy Markdown
Contributor

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

zerdos commented Mar 16, 2019

Copy link
Copy Markdown
Author

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