medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
22 stars 25 forks source link

chore(docker): update Docker image to support app development #543

Closed jkuester closed 1 year ago

jkuester commented 1 year ago

Updates the existing Dockerfile:

Adds documentation for how to use the image as a VSCode Dev Container or as a standalone Docker utility.

Closes #542

Not included

The following are not included (yet) in this MVP PR. Part of this review should be deciding if any of these are necessary for merging this PR (or if they can be added later).

Code review items

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

jkuester commented 1 year ago

FYI this was developed and tested on Linux, but I also have tested that this process works on Windows too! Using WSL, I was able to build the Docker image and then VSCode seamlessly picked up the image and everything worked as expected.

mrjones-plip commented 1 year ago

@jkuester - good stuff! I think we're close, but I think the docs in the readme need help. I got stuck because I've literally never used VSCode to write code (just as a nice text editor for .txt files). I didn't really know how to create a workspace and when I thought I did, and added the .devcontainer.json file, choosing Reopen in Container didn't work - instead t was prompting me to define a container or something? Video below.

I think we should be prescriptive toward a CHT experience - adding a new CHT app project with app settings initialized etc. And, yes, add a pre-built and published image (5 min build time for me both times!).

I'll grab ya tomorrow and we'll figure it out!

https://user-images.githubusercontent.com/8253488/222061857-0228fc86-fba7-4e98-871f-c76f7fbd44f5.mp4

andrablaj commented 1 year ago

FYI this was developed and tested on Linux, but I also have tested that this process works on Windows too! Using WSL, I was able to build the Docker image and then VSCode seamlessly picked up the image and everything worked as expected.

FYI, I just tested the README steps in MacOS with M1 chip, and everything ran correctly. 🎆

The only hiccup I encountered was when using VSCode's integrated terminal, where I got the error below. I didn't investigate further, and just used my Mac's terminal instead.

Screenshot 2023-03-01 at 12 58 18
jkuester commented 1 year ago

For the record, the problem encountered by @mrjones-plip as due to his .devcontainer.json being located at ./test/.devcontainer.json and not in the root of the workspace at ./.devcontainer.json.

Also, @andrablaj, your error is coming because you are trying to mix the usage modes! :smile: When using VSCode's integrated terminal (while having VSCode open in the Dev Container) the terminal is running in the container environment and not in your host environment. So, even though you have docker installed on your host machine, you cannot use the docker command from VSCode's integrated terminal because Docker is not installed inside the container! To run cht commands from within VSCode, you don't need the extra docker run ... stuff. You can just run cht ....

I will update the documentation here to be more clear on all these points!

andrablaj commented 1 year ago

Thanks @jkuester. 🙌 An update to the documentation would help, as more people might bump into the same question. I am stepping out of this PR, unless you need extra testing on MacOS. If it is the case, just ping me, I am happy to help.

jkuester commented 1 year ago

@Hareet I noticed that you were the one who originally created the Dockerfile here in cht-conf. Before we haul-off and make fundamental changes here, I wanted to check and see if you all were using this for some kind of scripting somewhere that we should be aware of (so we don't inadvertently break anything)?

jkuester commented 1 year ago

@mrjones-plip I made a few minor updates here:

medic-ci commented 1 year ago

:tada: This PR is included in version 3.16.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: