Skip to content
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

Adding Node.js files to workspace breaks when package.json in subfolder #2057

Closed
ucheNkadiCode opened this issue Jun 11, 2020 · 3 comments · Fixed by #2361
Closed

Adding Node.js files to workspace breaks when package.json in subfolder #2057

ucheNkadiCode opened this issue Jun 11, 2020 · 3 comments · Fixed by #2361

Comments

@ucheNkadiCode
Copy link
Contributor

I was following the Deploy images to ACI Tutorial and noticed that containerizing the app as-is was failing. I suspect it is because the package.json is found in a folder named app. Even though the docker-build and docker-run tasks don't reference this file, I am still blocked from hitting F5

Repro Steps:
From Terminal

  1. git clone https://github.com/Azure-Samples/aci-helloworld.git into a folder of choice
  2. code . to open editor
    Within VS Code
  3. Delete or Rename current Dockerfile to Dockerfile_original
  4. Ctrl + Shift + P Add Dockerfile to workspace and select Node.js
  5. I am met with this error:
    image
  6. After moving the package.json to the root folder, the container now builds, but during run there is the error:
    image
  7. This can be fixed by changing the main property in package.json to "./app/index.js" but I'm unsure if this problem would have persisted in a fresh node project scenario
@karolz-ms
Copy link
Contributor

@ucheNkadiCode showed me that even if Dockerfile is edited with correct path to package.json, the image build still fails with the error mentioned in step 5. This seems wrong.

@dbreshears dbreshears added this to the 1.4.0 milestone Jun 11, 2020
@dbreshears dbreshears added the P2 label Jun 11, 2020
@dbreshears dbreshears modified the milestones: 1.4.0, 1.5.0 Jul 1, 2020
@bwateratmsft
Copy link
Collaborator

bwateratmsft commented Jul 13, 2020

I spoke to @philliphoff, and we think the best approach is this:

  • The Docker build context, Dockerfile, and .dockerignore are always adjacent the package.json
  • Compose files are always at the workspace root

@bwateratmsft bwateratmsft self-assigned this Jul 20, 2020
@bwateratmsft bwateratmsft modified the milestones: 1.5.0, 1.6.0 Jul 24, 2020
@bwateratmsft bwateratmsft linked a pull request Aug 31, 2020 that will close this issue
@dbreshears dbreshears modified the milestones: 1.6.0, 1.7.0 Sep 3, 2020
@bwateratmsft bwateratmsft removed their assignment Oct 9, 2020
@bwateratmsft
Copy link
Collaborator

This is now fixed in Docker extension version 1.7.0.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants